[libchamplain] Fix segfault in local rendering demo on shutdown



commit af529d1228badacfc94e9ea6e65d8de5b0bd1d7d
Author: JiÅ?í Techet <techet gmail com>
Date:   Sun May 23 00:45:20 2010 +0200

    Fix segfault in local rendering demo on shutdown
    
    On shutdown the image displaying tile loading state can get destroyed
    before ChamplainView and if ChamplainView emits state change, it refers
    to a destroyed image and crashes.
    
    Signed-off-by: JiÅ?í Techet <techet gmail com>

 demos/launcher-gtk.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/demos/launcher-gtk.c b/demos/launcher-gtk.c
index 6070114..f39ad46 100644
--- a/demos/launcher-gtk.c
+++ b/demos/launcher-gtk.c
@@ -29,6 +29,7 @@
 #define COL_NAME 1
 
 static ChamplainPolygon *polygon;
+static gboolean destroying = FALSE;
 
 /*
  * Terminate the main loop.
@@ -36,6 +37,7 @@ static ChamplainPolygon *polygon;
 static void
 on_destroy (GtkWidget *widget, gpointer data)
 {
+  destroying = TRUE;
   gtk_main_quit ();
 }
 
@@ -115,16 +117,17 @@ view_state_changed (ChamplainView *view,
 {
   ChamplainState state;
 
+  if (destroying)
+    return;
+
   g_object_get (G_OBJECT (view), "state", &state, NULL);
   if (state == CHAMPLAIN_STATE_LOADING)
     {
       gtk_image_set_from_stock (image, GTK_STOCK_NETWORK, GTK_ICON_SIZE_BUTTON);
-      g_print("STATE: loading\n");
     }
   else
     {
       gtk_image_clear (image);
-      g_print("STATE: done\n");
     }
 }
 



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