[libgconf-bridge] Fix crash when closing windows



commit 3a1470c5691cc26957f8df6c3720da2199fa2736
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jul 7 17:16:52 2009 +0100

    Fix crash when closing windows

 libgconf-bridge/gconf-bridge.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/libgconf-bridge/gconf-bridge.c b/libgconf-bridge/gconf-bridge.c
index 375f749..d85e50f 100644
--- a/libgconf-bridge/gconf-bridge.c
+++ b/libgconf-bridge/gconf-bridge.c
@@ -654,14 +654,14 @@ window_binding_configure_event_cb (GtkWindow         *window,
                                    GdkEventConfigure *event,
                                    WindowBinding     *binding)
 {
+	/* Re-postpone by cancel of the previous request */
+	if (binding->sync_timeout_id > 0)
+		g_source_remove (binding->sync_timeout_id);
+
         /* Schedule a sync */
-        if (binding->sync_timeout_id == 0) {
-                binding->sync_timeout_id =
-                        g_timeout_add (WINDOW_BINDING_SYNC_DELAY,
-                                       (GSourceFunc)
-                                          window_binding_perform_scheduled_sync,
-                                       binding);
-        }
+        binding->sync_timeout_id = g_timeout_add (WINDOW_BINDING_SYNC_DELAY,
+						  (GSourceFunc)window_binding_perform_scheduled_sync,
+						  binding);
 
         return FALSE;
 }
@@ -672,6 +672,9 @@ window_binding_state_event_cb (GtkWindow           *window,
                                GdkEventWindowState *event,
                                WindowBinding       *binding)
 {
+        if (binding->sync_timeout_id > 0)
+                g_source_remove (binding->sync_timeout_id);
+
         window_binding_perform_scheduled_sync (binding);
 
         return FALSE;
@@ -702,6 +705,9 @@ window_binding_window_destroyed (gpointer user_data,
         binding->window = NULL; /* Don't do anything with the window
                                    at unbind() */
 
+        if (binding->sync_timeout_id > 0)
+                g_source_remove (binding->sync_timeout_id);
+
         g_hash_table_remove (bridge->bindings,
                              GUINT_TO_POINTER (binding->id));
 }



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