From e4d4de8c9e76bd7fa593d3dc9ba385d9da8b8d84 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 11 Jul 2012 21:37:59 +0300 Subject: [PATCH] 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 --- src/xkbcomp/symbols.c | 6 ++++++ 1 file changed, 6 insertions(+) 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) -- 2.7.4