Commit e4d4de8c9e76bd7fa593d3dc9ba385d9da8b8d84

Ran Benita 2012-07-11T21:37:59

symbols: fix bug in symbol merging When we merge two KeyInfo's (belonging to the same keycode), we may take a shortcut from copying if we see that the merged keys will be exactly like those in one of the two KeyInfo's. In the case where we take the symbols from the KeyInfo we are *not* merging into, we need to copy the three arrays: syms[group], symsMapNumEntries[group], symsMapIndex[group] The code currently only copies the first one, so if there's a merge conflict some levels may seem to disappear (i.e. have a NoSymbol keysym). This fixes the failing test added in c8d6bba. Signed-off-by: Ran Benita <ran234@gmail.com>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index c5b29e1..8de5cc7 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -411,6 +411,12 @@ MergeKeyGroups(SymbolsInfo * info,
     if (using == FROM)
     {
         resultSyms = from->syms[group];
+        darray_free(into->symsMapNumEntries[group]);
+        darray_free(into->symsMapIndex[group]);
+        into->symsMapNumEntries[group] = from->symsMapNumEntries[group];
+        into->symsMapIndex[group] = from->symsMapIndex[group];
+        darray_init(from->symsMapNumEntries[group]);
+        darray_init(from->symsMapIndex[group]);
         goto out;
     }
     else if (using == TO)