Deskguide crash bug - FIXED (I hope)



Package: gnome-core

It has recently been reported that the deskguide applit in the HEAD branch of
gnome-core sometimes crashes. This seems to occur when it attempts to draw a 
thumbnail of a window which is being closed. So, I compiled a version with
-g and waited for a crash. When I examined the core, I found a NULL
pointer dereference. The following patch should fix this one (there
may be many others but they haven't been discarvard - Tom Lehrer :-)).

diff -U3 -r gnome-core-old/applets/desk-guide/gwmthumbnail.c
gnome-core/applets/desk-guide/gwmthumbnail.c
--- gnome-core-old/applets/desk-guide/gwmthumbnail.c	Mon Aug 14 16:42:09
2000+++ gnome-core/applets/desk-guide/gwmthumbnail.c	Fri Sep 29 15:29:31
2000@@ -274,6 +274,7 @@
   gint sheight = gdk_screen_height ();
   GdkColormap *cmap = gdk_window_get_colormap (drawable);
   GdkPixbuf *shot_pixbuf = NULL;
+  GdkVisual *visual;
 
   /* the drawable relative rectangle (x, y, width, height) must be
    * confined to the root window rectangle (0, 0, swidth, sheight)
@@ -286,7 +287,7 @@
   /* fallback to root window's colormap */
   if (!cmap)
     {
-      GdkVisual *visual = gdk_window_get_visual (drawable);
+      visual = gdk_window_get_visual (drawable);
 
       if (visual && visual->depth == gdk_window_get_visual (NULL)->depth)
 	cmap = gdk_window_get_colormap (NULL);
@@ -298,7 +299,10 @@
   /* for depth matches, we first try to grab the image using our global
    * shared memory pixmap image
    */
-  if (shm_image && shm_image->depth == gdk_window_get_visual
(drawable)->depth)+  visual = gdk_window_get_visual (drawable);
+  if (!visual)		/* screwed again - maybe window is closing? */
+    return NULL;
+  if (shm_image && shm_image->depth == visual->depth)
     {
       GdkGCValues gc_values;
       GdkGC *gc;


--
Peter Wainwright
Home: prw wainpr demon co uk     Work: peter wainwright nrpb org uk
http://www.wainpr.demon.co.uk    Fax: +44-870-052-3185




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