Commit 5c47f8be authored by Rami Ylimäki's avatar Rami Ylimäki Committed by Peter Hutterer

xkb: Release XKB component names when compiling keymap.

Reviewed-by: 's avatarErkki Seppälä <erkki.seppala@vincit.fi>
Signed-off-by: 's avatarRami Ylimäki <rami.ylimaki@vincit.fi>
Reviewed-by: 's avatarPeter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: 's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 6f46ae3c
......@@ -447,6 +447,11 @@ extern _X_EXPORT void XkbFreeKeyboard(
Bool /* freeDesc */
);
extern _X_EXPORT void XkbFreeComponentNames(
XkbComponentNamesPtr /* names */,
Bool /* freeNames */
);
extern _X_EXPORT void XkbSetActionKeyMods(
XkbDescPtr /* xkb */,
XkbAction * /* act */,
......
......@@ -333,3 +333,22 @@ XkbFreeKeyboard(XkbDescPtr xkb,unsigned which,Bool freeAll)
free(xkb);
return;
}
/***====================================================================***/
void
XkbFreeComponentNames(XkbComponentNamesPtr names, Bool freeNames)
{
if (names)
{
free(names->keycodes);
free(names->types);
free(names->compat);
free(names->symbols);
free(names->geometry);
memset(names, 0, sizeof(XkbComponentNamesRec));
}
if (freeNames)
free(names);
}
......@@ -447,23 +447,23 @@ XkbRMLVOtoKcCGST(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, XkbComponentNamesPtr kccg
static XkbDescPtr
XkbCompileKeymapForDevice(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, int need)
{
XkbDescPtr xkb;
XkbDescPtr xkb = NULL;
unsigned int provided;
XkbComponentNamesRec kccgst;
XkbComponentNamesRec kccgst = {0};
char name[PATH_MAX];
if (!XkbRMLVOtoKcCGST(dev, rmlvo, &kccgst))
return NULL;
provided = XkbDDXLoadKeymapByNames(dev, &kccgst, XkmAllIndicesMask, need,
&xkb, name, PATH_MAX);
if ((need & provided) != need) {
if (xkb) {
XkbFreeKeyboard(xkb, 0, TRUE);
xkb = NULL;
if (XkbRMLVOtoKcCGST(dev, rmlvo, &kccgst)) {
provided = XkbDDXLoadKeymapByNames(dev, &kccgst, XkmAllIndicesMask, need,
&xkb, name, PATH_MAX);
if ((need & provided) != need) {
if (xkb) {
XkbFreeKeyboard(xkb, 0, TRUE);
xkb = NULL;
}
}
}
XkbFreeComponentNames(&kccgst, FALSE);
return xkb;
}
......
......@@ -5895,16 +5895,7 @@ ProcXkbGetKbdByName(ClientPtr client)
XkbFreeKeyboard(new,XkbAllComponentsMask,TRUE);
new= NULL;
}
free(names.keycodes);
names.keycodes = NULL;
free(names.types);
names.types = NULL;
free(names.compat);
names.compat = NULL;
free(names.symbols);
names.symbols = NULL;
free(names.geometry);
names.geometry = NULL;
XkbFreeComponentNames(&names, FALSE);
return Success;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment