summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2015-12-28 10:27:08 -0500
committerMatthias Clasen <mclasen@redhat.com>2015-12-28 10:27:08 -0500
commitba1636be87b9f5d567d8ca5dbd9ae4c7c2476a64 (patch)
treebefcf8e2ee02da017efc37fbb06eb4c77114c6b0
parente8ba05839665f9cfa87a96f5b2285ed8c783e830 (diff)
downloadgtk+-ba1636be87b9f5d567d8ca5dbd9ae4c7c2476a64.tar.gz
statusicon: Avoid criticals
The code handles the possibility of pixbuf being NULL, but after b411c318321fd4de556926119cbc6e3ba14f073a we must be prepared for surface already being NULL. Pointed out by Albert Muktupāvels, https://bugzilla.gnome.org/show_bug.cgi?id=759917
-rw-r--r--gtk/deprecated/gtkstatusicon.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gtk/deprecated/gtkstatusicon.c b/gtk/deprecated/gtkstatusicon.c
index 627a291f5b..29ccf77d23 100644
--- a/gtk/deprecated/gtkstatusicon.c
+++ b/gtk/deprecated/gtkstatusicon.c
@@ -1399,8 +1399,13 @@ gtk_status_icon_update_image (GtkStatusIcon *status_icon)
_gtk_icon_helper_set_icon_size (icon_helper, GTK_ICON_SIZE_SMALL_TOOLBAR);
_gtk_icon_helper_set_pixel_size (icon_helper, round_size);
surface = gtk_icon_helper_load_surface (icon_helper, 1);
- pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, round_size, round_size);
- cairo_surface_destroy (surface);
+ if (surface)
+ {
+ pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, round_size, round_size);
+ cairo_surface_destroy (surface);
+ }
+ else
+ pixbuf = NULL;
g_object_unref (icon_helper);
if (pixbuf != NULL)