[hitori] interface: Fix leak of top-level menu models
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hitori] interface: Fix leak of top-level menu models
- Date: Wed, 11 Jun 2014 09:08:09 +0000 (UTC)
commit 70d019a9c79336f9dbfce08445f458ad3bb88f2c
Author: Philip Withnall <philip tecnocode co uk>
Date: Wed Jun 11 10:02:49 2014 +0100
interface: Fix leak of top-level menu models
src/interface.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/interface.c b/src/interface.c
index c7014c0..295cdfc 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -75,6 +75,7 @@ hitori_create_interface (Hitori *hitori)
GtkBuilder *builder;
GtkStyleContext *style_context;
const PangoFontDescription *font;
+ GMenuModel *app_menu, *win_menu; /* owned */
builder = gtk_builder_new ();
@@ -106,11 +107,15 @@ hitori_create_interface (Hitori *hitori)
hitori->timer_label = GTK_LABEL (gtk_builder_get_object (builder, "hitori_timer"));
/* Set up the menus (application and window). */
+ app_menu = G_MENU_MODEL (gtk_builder_get_object (builder, "app_menu"));
g_action_map_add_action_entries (G_ACTION_MAP (hitori), app_entries, G_N_ELEMENTS (app_entries),
hitori);
- gtk_application_set_app_menu (GTK_APPLICATION (hitori), G_MENU_MODEL (gtk_builder_get_object
(builder, "app_menu")));
+ gtk_application_set_app_menu (GTK_APPLICATION (hitori), app_menu);
+ g_object_unref (app_menu);
+ win_menu = G_MENU_MODEL (gtk_builder_get_object (builder, "win_menu"));
g_action_map_add_action_entries (G_ACTION_MAP (hitori->window), win_entries, G_N_ELEMENTS
(win_entries), hitori);
- gtk_application_set_menubar (GTK_APPLICATION (hitori), G_MENU_MODEL (gtk_builder_get_object (builder,
"win_menu")));
+ gtk_application_set_menubar (GTK_APPLICATION (hitori), win_menu);
+ g_object_unref (win_menu);
hitori->undo_action = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (hitori->window),
"undo"));
hitori->redo_action = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (hitori->window),
"redo"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]