[gtk+/gtk-3-22] widget-factory: Don't leak GPropertyAction instances



commit 183c23d710ef7d7a13342f32474e37417b909e54
Author: Timm Bäder <mail baedert org>
Date:   Fri Oct 6 16:30:20 2017 +0200

    widget-factory: Don't leak GPropertyAction instances

 demos/widget-factory/widget-factory.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c
index 2872402..e9f0219 100644
--- a/demos/widget-factory/widget-factory.c
+++ b/demos/widget-factory/widget-factory.c
@@ -1728,12 +1728,14 @@ activate (GApplication *app)
 
   widget = (GtkWidget *)gtk_builder_get_object (builder, "statusbar");
   gtk_statusbar_push (GTK_STATUSBAR (widget), 0, "All systems are operating normally.");
-  g_action_map_add_action (G_ACTION_MAP (window),
-                           G_ACTION (g_property_action_new ("statusbar", widget, "visible")));
+  action = G_ACTION (g_property_action_new ("statusbar", widget, "visible"));
+  g_action_map_add_action (G_ACTION_MAP (window), action);
+  g_object_unref (G_OBJECT (action));
 
   widget = (GtkWidget *)gtk_builder_get_object (builder, "toolbar");
-  g_action_map_add_action (G_ACTION_MAP (window),
-                           G_ACTION (g_property_action_new ("toolbar", widget, "visible")));
+  action = G_ACTION (g_property_action_new ("toolbar", widget, "visible"));
+  g_action_map_add_action (G_ACTION_MAP (window), action);
+  g_object_unref (G_OBJECT (action));
 
   adj = (GtkAdjustment *)gtk_builder_get_object (builder, "adjustment1");
 


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