[nautilus] toolbar: Don't add a ref to menu_item
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] toolbar: Don't add a ref to menu_item
- Date: Tue, 30 Aug 2022 23:08:36 +0000 (UTC)
commit e8a40d3fbba6b8f694325692e132822587a94235
Author: Ignacy Kuchciński <ignacykuchcinski gmail com>
Date: Mon Aug 22 10:36:42 2022 +0200
toolbar: Don't add a ref to menu_item
g_set_object adds a ref, so don't use it in this case
src/nautilus-toolbar.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index 4b550a591..8d91cb29e 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -138,7 +138,8 @@ undo_manager_changed (NautilusToolbar *self)
g_autofree gchar *redo_description = NULL;
gboolean is_undo;
g_autoptr (GMenu) updated_section = g_menu_new ();
- g_autoptr (GMenuItem) menu_item = NULL;
+ g_autoptr (GMenuItem) undo_menu_item = NULL;
+ g_autoptr (GMenuItem) redo_menu_item = NULL;
/* Look up the last action from the undo manager, and get the text that
* describes it, e.g. "Undo Create Folder"/"Redo Create Folder"
@@ -166,8 +167,8 @@ undo_manager_changed (NautilusToolbar *self)
g_free (undo_label);
undo_label = g_strdup (_("_Undo"));
}
- g_set_object (&menu_item, g_menu_item_new (undo_label, "win.undo"));
- g_menu_append_item (updated_section, menu_item);
+ undo_menu_item = g_menu_item_new (undo_label, "win.undo");
+ g_menu_append_item (updated_section, undo_menu_item);
update_action (self, "undo", undo_active);
if (!redo_active || redo_label == NULL)
@@ -175,8 +176,8 @@ undo_manager_changed (NautilusToolbar *self)
g_free (redo_label);
redo_label = g_strdup (_("_Redo"));
}
- g_set_object (&menu_item, g_menu_item_new (redo_label, "win.redo"));
- g_menu_append_item (updated_section, menu_item);
+ redo_menu_item = g_menu_item_new (redo_label, "win.redo");
+ g_menu_append_item (updated_section, redo_menu_item);
update_action (self, "redo", redo_active);
nautilus_gmenu_set_from_model (G_MENU (self->undo_redo_section),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]