[nautilus/gnome-3-18] files-view: unref action group



commit d4bc3f3946cb081dcd3f5a84a3072b2cc3ca6a69
Author: Carlos Soriano <csoriano gnome org>
Date:   Thu Nov 26 17:31:27 2015 +0100

    files-view: unref action group
    
    We were leaking it, causing that the view was not free if
    there were some templates, since templates menu items were
    holding a ref to the view and are only freed when the closure
    of the action gets freed, which is the view action group.
    This was making the view to get never finalized, and therefore
    making all kind of problems afterwards.
    
    Upcoming patch will also make template not hold a ref to the view,
    even if the issue is fixed now, I think templates menu items holding
    a reference to the view is wrong.

 src/nautilus-files-view.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 5710888..7682a8f 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -2871,7 +2871,7 @@ nautilus_files_view_destroy (GtkWidget *object)
 }
 
 static void
-nautilus_files_view_finalize (GObject *object)
+nautilus_files_view_dispose (GObject *object)
 {
         NautilusFilesView *view;
 
@@ -2890,8 +2890,7 @@ nautilus_files_view_finalize (GObject *object)
 
         g_signal_handlers_disconnect_by_func (gnome_lockdown_preferences,
                                               schedule_update_context_menus, view);
-
-        g_hash_table_destroy (view->details->non_ready_files);
+        g_clear_object (&view->details->view_action_group);
         g_clear_object (&view->details->background_menu);
         g_clear_object (&view->details->selection_menu);
         g_clear_object (&view->details->view_menu_widget);
@@ -2901,6 +2900,18 @@ nautilus_files_view_finalize (GObject *object)
                                              NULL);
         }
 
+        G_OBJECT_CLASS (nautilus_files_view_parent_class)->dispose (object);
+}
+
+static void
+nautilus_files_view_finalize (GObject *object)
+{
+        NautilusFilesView *view;
+
+        view = NAUTILUS_FILES_VIEW (object);
+
+        g_hash_table_destroy (view->details->non_ready_files);
+
         G_OBJECT_CLASS (nautilus_files_view_parent_class)->finalize (object);
 }
 
@@ -7781,6 +7792,7 @@ nautilus_files_view_class_init (NautilusFilesViewClass *klass)
         oclass = G_OBJECT_CLASS (klass);
 
         oclass->finalize = nautilus_files_view_finalize;
+        oclass->dispose = nautilus_files_view_dispose;
         oclass->get_property = nautilus_files_view_get_property;
         oclass->set_property = nautilus_files_view_set_property;
 


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