Code

suppress warnings when closing a desktop but not program
authorbuliabyak <buliabyak@users.sourceforge.net>
Tue, 1 Apr 2008 17:31:17 +0000 (17:31 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Tue, 1 Apr 2008 17:31:17 +0000 (17:31 +0000)
src/display/sp-canvas.cpp

index 357d6ade7e0713d67c81a5fc1fe5222add7b3a29..d528f05e299aca7943b531c69df9bf6ef643032f 100644 (file)
@@ -1146,6 +1146,10 @@ sp_canvas_unrealize (GtkWidget *widget)
 {
     SPCanvas *canvas = SP_CANVAS (widget);
 
+    canvas->current_item = NULL;
+    canvas->grabbed_item = NULL;
+    canvas->focused_item = NULL;
+
     shutdown_transients (canvas);
 
     gdk_gc_destroy (canvas->pixmap_gc);
@@ -1539,6 +1543,9 @@ sp_canvas_motion (GtkWidget *widget, GdkEventMotion *event)
     if (event->window != SP_CANVAS_WINDOW (canvas))
         return FALSE;
 
+    if (canvas->pixmap_gc == NULL) // canvas being deleted
+        return FALSE;
+
     if (canvas->grabbed_event_mask & GDK_POINTER_MOTION_HINT_MASK) {
         gint x, y;
         gdk_window_get_pointer (widget->window, &x, &y, NULL);
@@ -2010,7 +2017,7 @@ paint (SPCanvas *canvas)
 static int
 do_update (SPCanvas *canvas)
 {
-    if (!canvas->root) // canvas may have already be destroyed by closing desktop durring interrupted display!
+    if (!canvas->root || !canvas->pixmap_gc) // canvas may have already be destroyed by closing desktop durring interrupted display!
         return TRUE;
 
     /* Cause the update if necessary */