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



commit 911529151571c54fcee3f231a1c1877ac52c0f9e
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 8d14034..5c80cab 100644
--- a/demos/widget-factory/widget-factory.c
+++ b/demos/widget-factory/widget-factory.c
@@ -1695,12 +1695,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]