[gtk+] Don't leak a list when activating keybindings



commit b097729d5a0016254fdbcde4077ba5004b1c6b30
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Apr 14 20:22:18 2011 -0400

    Don't leak a list when activating keybindings
    
    Patch by Rui Matos,
    https://bugzilla.gnome.org/show_bug.cgi?id=647790

 gtk/gtkkeyhash.c   |    5 +++--
 gtk/gtkmenushell.c |    7 +++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkkeyhash.c b/gtk/gtkkeyhash.c
index df67f53..f5063f7 100644
--- a/gtk/gtkkeyhash.c
+++ b/gtk/gtkkeyhash.c
@@ -372,8 +372,9 @@ keyval_in_group (GdkKeymap  *keymap,
  * This means that fuzzy matches won't be considered if their keyval is 
  * present in the current group.
  * 
- * Return value: A #GSList of matching entries.
- **/
+ * Return value: A newly-allocated #GSList of matching entries.
+ *     Free with g_slist_free() when no longer needed.
+ */
 GSList *
 _gtk_key_hash_lookup (GtkKeyHash      *key_hash,
 		      guint16          hardware_keycode,
diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c
index 0f22d47..1a5a097 100644
--- a/gtk/gtkmenushell.c
+++ b/gtk/gtkmenushell.c
@@ -1860,8 +1860,11 @@ gtk_menu_shell_activate_mnemonic (GtkMenuShell *menu_shell,
                                   event->group);
 
   if (entries)
-    result = _gtk_mnemonic_hash_activate (mnemonic_hash,
-                                          GPOINTER_TO_UINT (entries->data));
+    {
+      result = _gtk_mnemonic_hash_activate (mnemonic_hash,
+                                            GPOINTER_TO_UINT (entries->data));
+      g_slist_free (entries);
+    }
 
   return result;
 }



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