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




commit 58bb1d3900764b0d782c47ed6557712dad32299b
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.
    
    (Leak found in valgrind file provided by nekohayo in the same issue.)

 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]