ScrolledWindow: Dodge possible surplus disconnects
authorDaniel Boles <dboles@src.gnome.org>
Fri, 1 Sep 2017 15:03:36 +0000 (16:03 +0100)
committerDaniel Boles <dboles@src.gnome.org>
Fri, 1 Sep 2017 15:28:44 +0000 (16:28 +0100)
In case the outgoing Adjustment for whatever reason has other handlers
referring to this SW, be sure to avoid disconnecting any but our own.

gtk/gtkscrolledwindow.c

index 3058d3b37a3830ee397c76a707d122dbf1da9e5b..25e5d1cd3a1fbf14c19e41ab9a16e8cf7b2fa627 100644 (file)
@@ -2258,7 +2258,12 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
       if (old_adjustment == hadjustment)
        return;
 
-      g_signal_handlers_disconnect_by_data (old_adjustment, scrolled_window);
+      g_signal_handlers_disconnect_by_func (old_adjustment,
+                                            gtk_scrolled_window_adjustment_changed,
+                                            scrolled_window);
+      g_signal_handlers_disconnect_by_func (old_adjustment,
+                                            gtk_scrolled_window_adjustment_value_changed,
+                                            scrolled_window);
 
       gtk_adjustment_enable_animation (old_adjustment, NULL, 0);
       gtk_range_set_adjustment (GTK_RANGE (priv->hscrollbar), hadjustment);
@@ -2329,7 +2334,12 @@ gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window,
       if (old_adjustment == vadjustment)
        return;
 
-      g_signal_handlers_disconnect_by_data (old_adjustment, scrolled_window);
+      g_signal_handlers_disconnect_by_func (old_adjustment,
+                                            gtk_scrolled_window_adjustment_changed,
+                                            scrolled_window);
+      g_signal_handlers_disconnect_by_func (old_adjustment,
+                                            gtk_scrolled_window_adjustment_value_changed,
+                                            scrolled_window);
 
       gtk_adjustment_enable_animation (old_adjustment, NULL, 0);
       gtk_range_set_adjustment (GTK_RANGE (priv->vscrollbar), vadjustment);