summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2012-01-11 09:37:58 -0500
committerMatthias Clasen <mclasen@redhat.com>2012-01-11 09:44:30 -0500
commit5f8c77f6d5735e51a34edba407b1e76ab5ba4e9f (patch)
tree01f616a9dbc5ab111f05a7e9ac202bb7b246f7de /examples
parentb9c7f057f13cd43130a89ee0d7cf8b22646342dd (diff)
downloadgtk+-5f8c77f6d5735e51a34edba407b1e76ab5ba4e9f.tar.gz
Don't leak plugin actions
Pointed out by Guillaume Desmottes in bug 667695.
Diffstat (limited to 'examples')
-rw-r--r--examples/plugman.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/plugman.c b/examples/plugman.c
index 23c034fac0..4bd4f06748 100644
--- a/examples/plugman.c
+++ b/examples/plugman.c
@@ -223,6 +223,7 @@ enable_plugin (const gchar *name)
g_signal_connect (action, "activate", G_CALLBACK (plugin_action), (gpointer)name);
g_action_map_add_action (G_ACTION_MAP (g_application_get_default ()), action);
g_print ("Actions of '%s' plugin added\n", name);
+ g_object_unref (action);
plugin_menu = find_plugin_menu ();
if (plugin_menu)
@@ -230,14 +231,14 @@ enable_plugin (const gchar *name)
GMenu *section;
GMenuItem *item;
gchar *label;
- gchar *action;
+ gchar *action_name;
section = g_menu_new ();
label = g_strdup_printf ("Turn text %s", name);
- action = g_strconcat ("app.", name, NULL);
- g_menu_insert (section, 0, label, action);
+ action_name = g_strconcat ("app.", name, NULL);
+ g_menu_insert (section, 0, label, action_name);
g_free (label);
- g_free (action);
+ g_free (action_name);
item = g_menu_item_new_section (NULL, (GMenuModel*)section);
g_menu_item_set_attribute (item, "id", "s", name);
g_menu_append_item (G_MENU (plugin_menu), item);