[pve-devel] [PATCH spiceterm] fix add_keymap_entry for non us keymaps

Dominik Csapak d.csapak at proxmox.com
Thu Nov 30 14:46:05 CET 2017


the only difference between
g_hash_table_insert and g_hash_table_replace is which key gets
freed/used

insert reuses the old key while replace used the new key
both insert the value or replace the value if it already exists

since the key is in the structure we allocate, we always
want to use the new key, and the old structure to be freed

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/input.c b/input.c
index 5ee82de..71c9dac 100644
--- a/input.c
+++ b/input.c
@@ -713,7 +713,7 @@ add_keymap_entry(guint8 mask, guint8 keycode, guint keysym, guint unicode)
     e->keycode = keycode;
     e->hkey = mask << 8 | (keycode & 255);
 
-    g_hash_table_insert(keymap, &e->hkey, e);
+    g_hash_table_replace(keymap, &e->hkey, e);
 }
 
 
-- 
2.11.0





More information about the pve-devel mailing list