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.
This commit is contained in:
Benjamin Otte 2009-12-19 13:46:18 +01:00 committed by Tristan Van Berkom
parent 7545e7211c
commit 71d7b97a90

View File

@ -858,6 +858,9 @@ gtk_scrolled_window_destroy (GtkObject *object)
if (scrolled_window->hscrollbar) 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_unparent (scrolled_window->hscrollbar);
gtk_widget_destroy (scrolled_window->hscrollbar); gtk_widget_destroy (scrolled_window->hscrollbar);
g_object_unref (scrolled_window->hscrollbar); g_object_unref (scrolled_window->hscrollbar);
@ -865,6 +868,9 @@ gtk_scrolled_window_destroy (GtkObject *object)
} }
if (scrolled_window->vscrollbar) 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_unparent (scrolled_window->vscrollbar);
gtk_widget_destroy (scrolled_window->vscrollbar); gtk_widget_destroy (scrolled_window->vscrollbar);
g_object_unref (scrolled_window->vscrollbar); g_object_unref (scrolled_window->vscrollbar);