[nautilus/wip/antoniof/meets-valgrind: 3/12] toolbar: Don't leak menu models




commit d18e633d4d6680cee1381b5c0e2a3b8dd27f6c22
Author: António Fernandes <antoniof gnome org>
Date:   Sat Dec 19 18:02:07 2020 +0000

    toolbar: Don't leak menu models
    
    g_object_get() returns a ref to the property object. We must unref it.

 src/nautilus-toolbar.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index eb8605406..a64518d8e 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -1297,8 +1297,11 @@ slot_on_extensions_background_menu_changed (NautilusToolbar    *self,
                                             GParamSpec         *param,
                                             NautilusWindowSlot *slot)
 {
+    g_autoptr (GMenuModel) menu = NULL;
+
+    menu = nautilus_window_slot_get_extensions_background_menu (slot);
     nautilus_path_bar_set_extensions_background_menu (NAUTILUS_PATH_BAR (self->path_bar),
-                                                      nautilus_window_slot_get_extensions_background_menu 
(slot));
+                                                      menu);
 }
 
 static void
@@ -1306,8 +1309,11 @@ slot_on_templates_menu_changed (NautilusToolbar    *self,
                                 GParamSpec         *param,
                                 NautilusWindowSlot *slot)
 {
+    g_autoptr (GMenuModel) menu = NULL;
+
+    menu = nautilus_window_slot_get_templates_menu (slot);
     nautilus_path_bar_set_templates_menu (NAUTILUS_PATH_BAR (self->path_bar),
-                                          nautilus_window_slot_get_templates_menu (slot));
+                                          menu);
 }
 
 static void


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