[nautilus] canvas-view: don't crash on view leaks



commit e8fda3a811dc268287753eb85d1e0332a12fa6e2
Author: Carlos Soriano <csoriano gnome org>
Date:   Wed Oct 5 19:43:30 2016 +0200

    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

 src/nautilus-canvas-view.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c
index c7852f2..0e277ef 100644
--- a/src/nautilus-canvas-view.c
+++ b/src/nautilus-canvas-view.c
@@ -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);
 }


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