[MPlayer-cvslog] r34868 - trunk/gui/ui/widgets.c

ib subversion at mplayerhq.hu
Wed Apr 18 15:29:53 CEST 2012


Author: ib
Date: Wed Apr 18 15:29:53 2012
New Revision: 34868

Log:
Fix crash with icon that has unsupported format.

This closes Bugzilla #2057.

Modified:
   trunk/gui/ui/widgets.c

Modified: trunk/gui/ui/widgets.c
==============================================================================
--- trunk/gui/ui/widgets.c	Wed Apr 18 11:04:05 2012	(r34867)
+++ trunk/gui/ui/widgets.c	Wed Apr 18 15:29:53 2012	(r34868)
@@ -73,7 +73,7 @@ static const char gui_icon_name[] = "mpl
 
 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 @@ static void gtkLoadIcon(GtkIconTheme *th
 
     /* start up GTK which realizes the pixmaps */
     gtk_main_iteration_do(FALSE);
+
+    return (pixbuf != NULL);
 }
 
 void gtkInit(void)
@@ -136,13 +138,15 @@ void gtkInit(void)
 
     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);
 


More information about the MPlayer-cvslog mailing list