[gtk/wip/matthiasc/shortcut-4: 117/149] shortcutcontroller: Plug a memory leak



commit b2e6d4de5052eaa30ae80baaf607cff5362a651d
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 22 09:59:57 2020 -0400

    shortcutcontroller: Plug a memory leak
    
    g_list_model_get_item is transfer full :(

 gtk/gtkshortcutcontroller.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkshortcutcontroller.c b/gtk/gtkshortcutcontroller.c
index 0c2d1ba040..fedd5bfad8 100644
--- a/gtk/gtkshortcutcontroller.c
+++ b/gtk/gtkshortcutcontroller.c
@@ -277,8 +277,11 @@ gtk_shortcut_controller_run_controllers (GtkEventController *controller,
 
   for (i = 0; i < g_list_model_get_n_items (self->shortcuts); i++)
     {
+      GtkShortcut *shortcut = g_list_model_get_item (self->shortcuts, i);
+      g_object_unref (shortcut);
+
       if (gtk_shortcut_controller_trigger_shortcut (self, 
-                                                    g_list_model_get_item (self->shortcuts, i),
+                                                    shortcut,
                                                     i,
                                                     event,
                                                     enable_mnemonics))


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