list-view: don't crash on view leaks

Although we all love how Nautilus keeps us on the belt crashing when
there is a leak, users are not happy about that.

So let's make nautilus more docile and don't crash in case there is a
view leak. For that, disconnect all signals in the dispose handler
rather than in finalize.

https://bugzilla.gnome.org/show_bug.cgi?id=772462
parent dd785294
......@@ -3223,6 +3223,16 @@ nautilus_list_view_dispose (GObject *object)
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
g_signal_handlers_disconnect_by_func (clipboard, on_clipboard_owner_changed, list_view);
g_signal_handlers_disconnect_by_func (nautilus_preferences,
default_sort_order_changed_callback,
list_view);
g_signal_handlers_disconnect_by_func (nautilus_list_view_preferences,
default_visible_columns_changed_callback,
list_view);
g_signal_handlers_disconnect_by_func (nautilus_list_view_preferences,
default_column_order_changed_callback,
list_view);
G_OBJECT_CLASS (nautilus_list_view_parent_class)->dispose (object);
}
......@@ -3267,16 +3277,6 @@ nautilus_list_view_finalize (GObject *object)
g_free (list_view->details);
g_signal_handlers_disconnect_by_func (nautilus_preferences,
default_sort_order_changed_callback,
list_view);
g_signal_handlers_disconnect_by_func (nautilus_list_view_preferences,
default_visible_columns_changed_callback,
list_view);
g_signal_handlers_disconnect_by_func (nautilus_list_view_preferences,
default_column_order_changed_callback,
list_view);
G_OBJECT_CLASS (nautilus_list_view_parent_class)->finalize (object);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment