canvas-view: don't crash on view leaks

Similar to previous commit but for the canvas view.

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 6015ea40
......@@ -1937,6 +1937,17 @@ nautilus_canvas_view_finalize (GObject *object)
g_free (canvas_view->details);
G_OBJECT_CLASS (nautilus_canvas_view_parent_class)->finalize (object);
}
static void
nautilus_canvas_view_dispose (GObject *object)
{
NautilusCanvasView *canvas_view;
canvas_view = NAUTILUS_CANVAS_VIEW (object);
canvas_view->details->destroyed = TRUE;
g_signal_handlers_disconnect_by_func (nautilus_preferences,
default_sort_order_changed_callback,
canvas_view);
......@@ -1948,16 +1959,6 @@ nautilus_canvas_view_finalize (GObject *object)
text_attribute_names_changed_callback,
canvas_view);
G_OBJECT_CLASS (nautilus_canvas_view_parent_class)->finalize (object);
}
static void
nautilus_canvas_view_dispose (GObject *object)
{
NautilusCanvasView *canvas_view;
canvas_view = NAUTILUS_CANVAS_VIEW (object);
canvas_view->details->destroyed = TRUE;
G_OBJECT_CLASS (nautilus_canvas_view_parent_class)->dispose (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