xkbcomp/types: fix types being assigned the wrong number of levels in some circumstances The buggy code assigned the number of levels based on the number of level names in the definition, instead of the actual number of levels! This would completely break type definitions which do not give names to levels. This was not noticed for so long because xkeyboard-config always gives names to all levels. This regressed in 61fed8dab9b8e27981f36ffc96666d7376546e30. Reported-by: Gatis Paeglis <gatis.paeglis@qt.io> Signed-off-by: Ran Benita <ran234@gmail.com>
diff --git a/src/xkbcomp/types.c b/src/xkbcomp/types.c
index 8d87ad5..4696086 100644
--- a/src/xkbcomp/types.c
+++ b/src/xkbcomp/types.c
@@ -701,8 +701,9 @@ CopyKeyTypesToKeymap(struct xkb_keymap *keymap, KeyTypesInfo *info)
type->name = def->name;
type->mods.mods = def->mods;
+ type->num_levels = def->num_levels;
darray_steal(def->level_names,
- &type->level_names, &type->num_levels);
+ &type->level_names, NULL);
darray_steal(def->entries,
&type->entries, &type->num_entries);
}