Re: Problem with gdk_image_get() failing



I forgot to say that if gdk_image_get() is changed to return NULL
instead of segfaulting, then gdk-pixbuf-drawable.c needs a tiny change
as well.  Patch for that attatched.

thanks

-re

Ramiro Estrugo wrote:
> 
> I just ran into a problem with gdk_image_get().  The issue is that if
> XGetImage() fails and returns NULL, gdk_image_get () will segfault
> trying to dereference the NULL ximage result.
> 
> -re
>
Index: gdk-pixbuf-drawable.c
===================================================================
RCS file: /cvs/gnome/gdk-pixbuf/gdk-pixbuf/gdk-pixbuf-drawable.c,v
retrieving revision 1.21
diff -u -u -r1.21 gdk-pixbuf-drawable.c
--- gdk-pixbuf-drawable.c	2000/08/23 23:00:30	1.21
+++ gdk-pixbuf-drawable.c	2000/12/15 04:12:08
@@ -1146,7 +1146,8 @@
 
 	/* Get Image in ZPixmap format (packed bits). */
 	image = gdk_image_get (src, src_x, src_y, width, height);
-	g_return_val_if_fail (image != NULL, NULL);
+	if (!image)
+		return NULL;
 
 	/* Create the pixbuf if needed */
 	if (!dest) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]