diff options
author | John Ralls <jralls@ceridwen.us> | 2011-11-07 13:04:59 -0800 |
---|---|---|
committer | John Ralls <jralls@ceridwen.us> | 2011-11-07 13:11:18 -0800 |
commit | 8216324e4b13f0349ed3c0f854d41e6b32d1f0cb (patch) | |
tree | 91c1d985e7ec2edd0cfcc33e0722f9e7d12ee532 /gtk/gtkquartz.c | |
parent | ac943bf69a87c992cfde59c6720ef08fdd20e683 (diff) | |
download | gtk+-8216324e4b13f0349ed3c0f854d41e6b32d1f0cb.tar.gz |
[Quartz Bug 663182] NSImage throws an exception from _gtk_quartz_create_image_from_pixbuf()
If _gtk_quartz_create_image_from_pixbuf is given a pixbuf with size 0, 0
or which produces an NSImage with size 0.0, 0.0, it throws an exception
which Gtk doesn't handle.
your changes. Lines starting
Diffstat (limited to 'gtk/gtkquartz.c')
-rw-r--r-- | gtk/gtkquartz.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gtk/gtkquartz.c b/gtk/gtkquartz.c index 74570005cd..3b9558d387 100644 --- a/gtk/gtkquartz.c +++ b/gtk/gtkquartz.c @@ -35,9 +35,11 @@ _gtk_quartz_create_image_from_pixbuf (GdkPixbuf *pixbuf) int rowstride, pixbuf_width, pixbuf_height; gboolean has_alpha; NSImage *nsimage; + NSSize nsimage_size; pixbuf_width = gdk_pixbuf_get_width (pixbuf); pixbuf_height = gdk_pixbuf_get_height (pixbuf); + g_return_val_if_fail (pixbuf_width == 0 && pixbuf_height == 0, NULL); rowstride = gdk_pixbuf_get_rowstride (pixbuf); has_alpha = gdk_pixbuf_get_has_alpha (pixbuf); @@ -57,6 +59,12 @@ _gtk_quartz_create_image_from_pixbuf (GdkPixbuf *pixbuf) CGColorSpaceRelease (colorspace); nsimage = [[NSImage alloc] initWithSize:NSMakeSize (pixbuf_width, pixbuf_height)]; + nsimage_size = [nsimage size]; + if (size.width == 0.0 && size.height == 0.0) + { + [nsimage release]; + g_return_val_if_fail (FALSE, NULL); + } [nsimage lockFocus]; context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; |