Changeset 52309 in webkit


Ignore:
Timestamp:
Dec 18, 2009 6:01:19 AM (14 years ago)
Author:
Philippe Normand
Message:

2009-12-18 Philippe Normand <pnormand@igalia.com>

Reviewed by Xan Lopez.

[GTK] segfault during controls initialization if not GTK theme is present.
https://bugs.webkit.org/show_bug.cgi?id=32705

Create empty images for the controls if no GTK theme is set.

  • platform/graphics/gtk/ImageGtk.cpp: (WebCore::getThemeIconFileName): (WebCore::loadImageFromFile):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r52308 r52309  
     12009-12-18  Philippe Normand  <pnormand@igalia.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        [GTK] segfault during controls initialization if not GTK theme is present.
     6        https://bugs.webkit.org/show_bug.cgi?id=32705
     7
     8        Create empty images for the controls if no GTK theme is set.
     9
     10        * platform/graphics/gtk/ImageGtk.cpp:
     11        (WebCore::getThemeIconFileName):
     12        (WebCore::loadImageFromFile):
     13
    1142009-12-18  Alejandro G. Castro  <alex@igalia.com>
    215
  • trunk/WebCore/platform/graphics/gtk/ImageGtk.cpp

    r52266 r52309  
    4949    GtkIconInfo* iconInfo = gtk_icon_theme_lookup_icon(gtk_icon_theme_get_default(),
    5050                                                       name, size, GTK_ICON_LOOKUP_NO_SVG);
     51    // Try to fallback on MISSING_IMAGE.
    5152    if (!iconInfo)
    5253        iconInfo = gtk_icon_theme_lookup_icon(gtk_icon_theme_get_default(),
    5354                                              GTK_STOCK_MISSING_IMAGE, size,
    5455                                              GTK_ICON_LOOKUP_NO_SVG);
     56    if (iconInfo) {
     57        GOwnPtr<GtkIconInfo> info(iconInfo);
     58        return CString(gtk_icon_info_get_filename(info.get()));
     59    }
    5560
    56     GOwnPtr<GtkIconInfo> info(iconInfo);
    57     return CString(gtk_icon_info_get_filename(info.get()));
     61    // No icon was found, this can happen if not GTK theme is set. In
     62    // that case an empty Image will be created.
     63    return CString();
    5864}
    5965
     
    7985{
    8086    RefPtr<BitmapImage> img = BitmapImage::create();
    81     RefPtr<SharedBuffer> buffer = loadResourceSharedBuffer(fileName);
    82     img->setData(buffer.release(), true);
     87    if (!fileName.isNull()) {
     88        RefPtr<SharedBuffer> buffer = loadResourceSharedBuffer(fileName);
     89        img->setData(buffer.release(), true);
     90    }
    8391    return img.release();
    8492}
Note: See TracChangeset for help on using the changeset viewer.