symbols: fix bug in symbol merging
authorRan Benita <ran234@gmail.com>
Wed, 11 Jul 2012 18:37:59 +0000 (21:37 +0300)
committerDaniel Stone <daniel@fooishbar.org>
Thu, 12 Jul 2012 08:42:12 +0000 (09:42 +0100)
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>
src/xkbcomp/symbols.c

index c5b29e1..8de5cc7 100644 (file)
@@ -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)