[gnome-builder/ebassi/gnome-app-template: 8/8] meson-templates: Plug a leak in the C template




commit 3c579a02ec849e8b43194bbd27d531e7b08a92fd
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Fri Feb 11 19:10:47 2022 +0000

    meson-templates: Plug a leak in the C template
    
    The GActionMap interface acquires a reference on the action added into
    it, which means we need to drop the reference we have on the action.

 src/plugins/meson-templates/resources/src/application.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/meson-templates/resources/src/application.c 
b/src/plugins/meson-templates/resources/src/application.c
index 033a685ed..f3a4030f3 100644
--- a/src/plugins/meson-templates/resources/src/application.c
+++ b/src/plugins/meson-templates/resources/src/application.c
@@ -92,11 +92,11 @@ static void
 static void
 {{prefix_}}_application_init ({{PreFix}}Application *self)
 {
-  GSimpleAction *quit_action = g_simple_action_new ("quit", NULL);
+  g_autoptr (GSimpleAction) quit_action = g_simple_action_new ("quit", NULL);
   g_signal_connect_swapped (quit_action, "activate", G_CALLBACK (g_application_quit), self);
   g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (quit_action));
 
-  GSimpleAction *about_action = g_simple_action_new ("about", NULL);
+  g_autoptr (GSimpleAction) about_action = g_simple_action_new ("about", NULL);
   g_signal_connect (about_action, "activate", G_CALLBACK ({{prefix_}}_application_show_about), self);
   g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (about_action));
 


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