comparison gtk3/dw.c @ 1709:de49c1f284b2

Safety check for the icon resize code on Mac and GTK.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 05 May 2012 21:41:57 +0000
parents fb6807b0ab0d
children fae374a0055b
comparison
equal deleted inserted replaced
1708:cc10082567ed 1709:de49c1f284b2
5667 } 5667 }
5668 5668
5669 /* Internal function to keep HICNs from getting too big */ 5669 /* Internal function to keep HICNs from getting too big */
5670 GdkPixbuf *_icon_resize(GdkPixbuf *ret) 5670 GdkPixbuf *_icon_resize(GdkPixbuf *ret)
5671 { 5671 {
5672 int pwidth = gdk_pixbuf_get_width(ret); 5672 if(ret)
5673 int pheight = gdk_pixbuf_get_height(ret); 5673 {
5674 5674 int pwidth = gdk_pixbuf_get_width(ret);
5675 if(pwidth > 24 || pheight > 24) 5675 int pheight = gdk_pixbuf_get_height(ret);
5676 { 5676
5677 GdkPixbuf *orig = ret; 5677 if(pwidth > 24 || pheight > 24)
5678 ret = gdk_pixbuf_scale_simple(ret, pwidth > 24 ? 24 : pwidth, pheight > 24 ? 24 : pheight, GDK_INTERP_BILINEAR); 5678 {
5679 g_object_unref(G_OBJECT(orig)); 5679 GdkPixbuf *orig = ret;
5680 ret = gdk_pixbuf_scale_simple(ret, pwidth > 24 ? 24 : pwidth, pheight > 24 ? 24 : pheight, GDK_INTERP_BILINEAR);
5681 g_object_unref(G_OBJECT(orig));
5682 }
5680 } 5683 }
5681 return ret; 5684 return ret;
5682 } 5685 }
5683 5686
5684 /* 5687 /*