[nautilus/gnome-3-18] files-view: better memory management for widgets
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/gnome-3-18] files-view: better memory management for widgets
- Date: Thu, 26 Nov 2015 16:40:07 +0000 (UTC)
commit d28472d05be26e7e38f9119050d9c77f9f4394e7
Author: Carlos Soriano <csoriano gnome org>
Date: Thu Nov 26 16:15:37 2015 +0100
files-view: better memory management for widgets
We were leaking them refing and not unrefing.
ref sink them and unref them on finalize.
src/nautilus-files-view.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index b0e0187..5710888 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -2892,6 +2892,9 @@ nautilus_files_view_finalize (GObject *object)
schedule_update_context_menus, view);
g_hash_table_destroy (view->details->non_ready_files);
+ g_clear_object (&view->details->background_menu);
+ g_clear_object (&view->details->selection_menu);
+ g_clear_object (&view->details->view_menu_widget);
if (view->details->rename_file_popover != NULL) {
gtk_popover_set_relative_to (GTK_POPOVER (view->details->rename_file_popover),
@@ -6623,8 +6626,8 @@ real_update_context_menus (NautilusFilesView *view)
GtkBuilder *builder;
builder = gtk_builder_new_from_resource
("/org/gnome/nautilus/nautilus-files-view-context-menus.xml");
- view->details->background_menu = g_object_ref (G_MENU (gtk_builder_get_object (builder,
"background-menu")));
- view->details->selection_menu = g_object_ref (G_MENU (gtk_builder_get_object (builder,
"selection-menu")));
+ view->details->background_menu = g_object_ref_sink (G_MENU (gtk_builder_get_object (builder,
"background-menu")));
+ view->details->selection_menu = g_object_ref_sink (G_MENU (gtk_builder_get_object (builder,
"selection-menu")));
g_object_unref (builder);
update_selection_menu (view);
@@ -7922,7 +7925,7 @@ nautilus_files_view_init (NautilusFilesView *view)
/* View menu */
builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/nautilus-toolbar-view-menu.xml");
- view->details->view_menu_widget = g_object_ref (gtk_builder_get_object (builder,
"view_menu_widget"));
+ view->details->view_menu_widget = g_object_ref_sink (gtk_builder_get_object (builder,
"view_menu_widget"));
view->details->zoom_level_scale = GTK_WIDGET (gtk_builder_get_object (builder, "zoom_level_scale"));
view->details->zoom_adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (builder,
"zoom_adjustment"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]