# HG changeset patch # User ib # Date 1334755793 0 # Node ID 70d16eb7899e4123ec8ab4268f65677e588addcc # Parent e59ffa59d825b7cc9db990badb9c04fc7c8db99c Fix crash with icon that has unsupported format. This closes Bugzilla #2057. diff -r e59ffa59d825 -r 70d16eb7899e gui/ui/widgets.c --- a/gui/ui/widgets.c Wed Apr 18 09:04:05 2012 +0000 +++ b/gui/ui/widgets.c Wed Apr 18 13:29:53 2012 +0000 @@ -73,7 +73,7 @@ guiIcon_t guiIcon; -static void gtkLoadIcon(GtkIconTheme *theme, gint size, GdkPixmap **gdkIcon, GdkBitmap **gdkIconMask) +static int gtkLoadIcon(GtkIconTheme *theme, gint size, GdkPixmap **gdkIcon, GdkBitmap **gdkIconMask) { GdkPixbuf *pixbuf; guchar *data; @@ -109,6 +109,8 @@ /* start up GTK which realizes the pixmaps */ gtk_main_iteration_do(FALSE); + + return (pixbuf != NULL); } void gtkInit(void) @@ -136,13 +138,15 @@ theme = gtk_icon_theme_get_default(); - gtkLoadIcon(theme, 16, &gdkIcon, &gdkIconMask); + if (gtkLoadIcon(theme, 16, &gdkIcon, &gdkIconMask)) { guiIcon.small = GDK_PIXMAP_XID(gdkIcon); guiIcon.small_mask = GDK_PIXMAP_XID(gdkIconMask); + } - gtkLoadIcon(theme, 32, &gdkIcon, &gdkIconMask); + if (gtkLoadIcon(theme, 32, &gdkIcon, &gdkIconMask)) { guiIcon.normal = GDK_PIXMAP_XID(gdkIcon); guiIcon.normal_mask = GDK_PIXMAP_XID(gdkIconMask); + } gtkLoadIcon(theme, 48, &gdkIcon, &gdkIconMask);