[yelp] Don't use g_source_remove for signal handlers



commit b1056e5a632ad2fe28bf30c46ad07f54278f7532
Author: Shaun McCance <shaunm gnome org>
Date:   Tue Feb 25 10:25:47 2014 -0500

    Don't use g_source_remove for signal handlers
    
    This fixes reliable crashes when changing bookmarks or the read later
    list if any single window has been closed.

 libyelp/yelp-location-entry.c |   10 +++++-----
 libyelp/yelp-view.c           |    8 ++++----
 src/yelp-window.c             |    4 ++--
 3 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/libyelp/yelp-location-entry.c b/libyelp/yelp-location-entry.c
index cb41c26..5b970a0 100644
--- a/libyelp/yelp-location-entry.c
+++ b/libyelp/yelp-location-entry.c
@@ -520,16 +520,16 @@ location_entry_dispose (GObject *object)
         priv->view = NULL;
     }
 
+    if (priv->bookmarks_changed) {
+        g_signal_handler_disconnect (priv->bookmarks, priv->bookmarks_changed);
+        priv->bookmarks_changed = 0;
+    }
+
     if (priv->bookmarks) {
         g_object_unref (priv->bookmarks);
         priv->bookmarks = NULL;
     }
 
-    if (priv->bookmarks_changed) {
-        g_source_remove (priv->bookmarks_changed);
-        priv->bookmarks_changed = 0;
-    }
-
     if (priv->row) {
         gtk_tree_row_reference_free (priv->row);
         priv->row = NULL;
diff --git a/libyelp/yelp-view.c b/libyelp/yelp-view.c
index 1529137..f27dd2e 100644
--- a/libyelp/yelp-view.c
+++ b/libyelp/yelp-view.c
@@ -306,12 +306,12 @@ yelp_view_dispose (GObject *object)
     view_clear_load (YELP_VIEW (object));
 
     if (priv->vadjuster > 0) {
-        g_source_remove (priv->vadjuster);
+        g_signal_handler_disconnect (priv->vadjustment, priv->vadjuster);
         priv->vadjuster = 0;
     }
 
     if (priv->hadjuster > 0) {
-        g_source_remove (priv->hadjuster);
+        g_signal_handler_disconnect (priv->hadjustment, priv->hadjuster);
         priv->hadjuster = 0;
     }
 
@@ -883,7 +883,7 @@ view_set_hadjustment (YelpView      *view,
     YelpViewPrivate *priv = GET_PRIV (view);
     priv->hadjustment = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (view));
     if (priv->hadjuster > 0)
-        g_source_remove (priv->hadjuster);
+        g_signal_handler_disconnect (priv->hadjustment, priv->hadjuster);
     priv->hadjuster = 0;
     if (priv->hadjustment)
         priv->hadjuster = g_signal_connect (priv->hadjustment, "value-changed",
@@ -898,7 +898,7 @@ view_set_vadjustment (YelpView      *view,
     YelpViewPrivate *priv = GET_PRIV (view);
     priv->vadjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (view));
     if (priv->vadjuster > 0)
-        g_source_remove (priv->vadjuster);
+        g_signal_handler_disconnect (priv->vadjustment, priv->vadjuster);
     priv->vadjuster = 0;
     if (priv->vadjustment)
         priv->vadjuster = g_signal_connect (priv->vadjustment, "value-changed",
diff --git a/src/yelp-window.c b/src/yelp-window.c
index d36c8fe..e84e226 100644
--- a/src/yelp-window.c
+++ b/src/yelp-window.c
@@ -335,12 +335,12 @@ yelp_window_dispose (GObject *object)
     }
 
     if (priv->read_later_changed) {
-        g_source_remove (priv->read_later_changed);
+        g_signal_handler_disconnect (priv->application, priv->read_later_changed);
         priv->read_later_changed = 0;
     }
 
     if (priv->bookmarks_changed) {
-        g_source_remove (priv->bookmarks_changed);
+        g_signal_handler_disconnect (priv->application, priv->bookmarks_changed);
         priv->bookmarks_changed = 0;
     }
 


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