[gtk+] Disconnect signal handlers on adjustment in destroy handler



commit ff1343a594383e0d88b1aecdf34025dd3ee36ed6
Author: Benjamin Otte <otte gnome org>
Date:   Sat Dec 19 13:46:18 2009 +0100

    Disconnect signal handlers on adjustment in destroy handler
    
    Not removing the signal handler caused crashes if the adjustment
    survived longer than the scrolled window and still emitted signals. This
    could happen inside WebKit.

 gtk/gtkscrolledwindow.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index b4112ae..d2d8769 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -852,6 +852,9 @@ gtk_scrolled_window_destroy (GtkObject *object)
 
   if (scrolled_window->hscrollbar)
     {
+      g_signal_handlers_disconnect_by_func (gtk_range_get_adjustment (GTK_RANGE (scrolled_window->hscrollbar)),
+					    gtk_scrolled_window_adjustment_changed,
+					    scrolled_window);
       gtk_widget_unparent (scrolled_window->hscrollbar);
       gtk_widget_destroy (scrolled_window->hscrollbar);
       g_object_unref (scrolled_window->hscrollbar);
@@ -859,6 +862,9 @@ gtk_scrolled_window_destroy (GtkObject *object)
     }
   if (scrolled_window->vscrollbar)
     {
+      g_signal_handlers_disconnect_by_func (gtk_range_get_adjustment (GTK_RANGE (scrolled_window->vscrollbar)),
+					    gtk_scrolled_window_adjustment_changed,
+					    scrolled_window);
       gtk_widget_unparent (scrolled_window->vscrollbar);
       gtk_widget_destroy (scrolled_window->vscrollbar);
       g_object_unref (scrolled_window->vscrollbar);



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