summaryrefslogtreecommitdiff
path: root/gtk/gtkkeyhash.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2004-12-31 06:40:05 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2004-12-31 06:40:05 +0000
commitd4e082d71c8dc60d4a714a7fcc186e37c4b022ba (patch)
tree54c8c9f7cdad4ee91d811d5a86800028ddeff32d /gtk/gtkkeyhash.c
parent3a316fb562e268e83378a310ad0fdd66690718de (diff)
downloadgtk+-d4e082d71c8dc60d4a714a7fcc186e37c4b022ba.tar.gz
Don't sort a list of values as if it was a list of entries. This fixes
2004-12-31 Matthias Clasen <mclasen@redhat.com> * gtk/gtkkeyhash.c (_gtk_key_hash_lookup_keyval) (_gtk_key_hash_lookup): Don't sort a list of values as if it was a list of entries. This fixes crashes during mnemonic activation in the presence of multiple keymaps. (#162488, Christian Persch)
Diffstat (limited to 'gtk/gtkkeyhash.c')
-rw-r--r--gtk/gtkkeyhash.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/gtk/gtkkeyhash.c b/gtk/gtkkeyhash.c
index 3ff8deb687..9d4e41b71c 100644
--- a/gtk/gtkkeyhash.c
+++ b/gtk/gtkkeyhash.c
@@ -332,6 +332,7 @@ _gtk_key_hash_lookup (GtkKeyHash *key_hash,
GHashTable *keycode_hash = key_hash_get_keycode_hash (key_hash);
GSList *keys = g_hash_table_lookup (keycode_hash, GUINT_TO_POINTER ((guint)hardware_keycode));
GSList *results = NULL;
+ GSList *l;
gboolean have_exact = FALSE;
guint keyval;
gint effective_group;
@@ -375,7 +376,7 @@ _gtk_key_hash_lookup (GtkKeyHash *key_hash,
}
have_exact = TRUE;
- results = g_slist_prepend (results, entry->value);
+ results = g_slist_prepend (results, entry);
}
if (!have_exact)
@@ -388,7 +389,7 @@ _gtk_key_hash_lookup (GtkKeyHash *key_hash,
GTK_NOTE (KEYBINDINGS,
g_message (" found group = %d, level = %d",
entry->keys[i].group, entry->keys[i].level));
- results = g_slist_prepend (results, entry->value);
+ results = g_slist_prepend (results, entry);
break;
}
}
@@ -399,7 +400,11 @@ _gtk_key_hash_lookup (GtkKeyHash *key_hash,
}
}
- return sort_lookup_results (results);
+ results = sort_lookup_results (results);
+ for (l = results; l; l = l->next)
+ l->data = ((GtkKeyHashEntry *)l->data)->value;
+
+ return results;
}
/**
@@ -423,6 +428,7 @@ _gtk_key_hash_lookup_keyval (GtkKeyHash *key_hash,
GdkKeymapKey *keys;
gint n_keys;
GSList *results = NULL;
+ GSList *l;
if (!keyval) /* Key without symbol */
return NULL;
@@ -442,7 +448,7 @@ _gtk_key_hash_lookup_keyval (GtkKeyHash *key_hash,
GtkKeyHashEntry *entry = entries->data;
if (entry->keyval == keyval && entry->modifiers == modifiers)
- results = g_slist_prepend (results, entry->value);
+ results = g_slist_prepend (results, entry);
entries = entries->next;
}
@@ -450,5 +456,9 @@ _gtk_key_hash_lookup_keyval (GtkKeyHash *key_hash,
g_free (keys);
- return sort_lookup_results (results);
+ results = sort_lookup_results (results);
+ for (l = results; l; l = l->next)
+ l->data = ((GtkKeyHashEntry *)l->data)->value;
+
+ return results;
}