[gtk/shortcuts-rebased-again: 99/135] shortcutcontroller: Unref shortcut proper



commit cf1bb8844abb3d6a0a0668c5fd1792400b405fd5
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon May 13 22:43:51 2019 -0300

    shortcutcontroller: Unref shortcut proper
    
    g_list_model_get_item() is transfer full, so we need to
    unref everything that is acquired through it.

 gtk/gtkshortcutcontroller.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkshortcutcontroller.c b/gtk/gtkshortcutcontroller.c
index 17147ba113..31fbac549b 100644
--- a/gtk/gtkshortcutcontroller.c
+++ b/gtk/gtkshortcutcontroller.c
@@ -275,8 +275,12 @@ gtk_shortcut_controller_run_controllers (GtkEventController *controller,
 
   for (i = 0; i < g_list_model_get_n_items (self->shortcuts); i++)
     {
-      if (gtk_shortcut_controller_trigger_shortcut (self, 
-                                                    g_list_model_get_item (self->shortcuts, i),
+      GtkShortcut *shortcut = g_list_model_get_item (self->shortcuts, i);
+
+      g_object_unref (shortcut);
+
+      if (gtk_shortcut_controller_trigger_shortcut (self,
+                                                    shortcut,
                                                     i,
                                                     event,
                                                     enable_mnemonics))


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