xkb: Fix key type without level names in XkbCopyKeymap

A key type that has no level names is legit. Before this commit,
`XkbCopyKeymap` would make such level inconsistent by setting its
number of levels to 0 while keeping its map entries. It suffices
to clear the names array.

Fixed by copying the level count from the source type.

WARNING: this will trigger an error in `XkbGetNames`, which worked
before this commit only by chance. This is fixed in the next commit.
This commit is contained in:
Pierre Le Marre 2025-10-15 23:53:24 +02:00
parent 6f31791945
commit 9ddaf5b1ee
No known key found for this signature in database
GPG key ID: 3BFB00E5C59E818E

View file

@ -1044,7 +1044,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
if (dtype->num_levels && dtype->level_names &&
i < dst->map->num_types)
free(dtype->level_names);
dtype->num_levels = 0;
dtype->num_levels = stype->num_levels;
dtype->level_names = NULL;
}