Free all atoms along with keymap
The code to do this is taken from xserver, dix/atom.c. Signed-off-by: Ran Benita <ran234@gmail.com>master
parent
d94d9b4522
commit
19e99bb27a
23
src/atom.c
23
src/atom.c
|
@ -215,3 +215,26 @@ xkb_intern_atom(const char *string)
|
||||||
else
|
else
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
FreeAtom(NodePtr patom)
|
||||||
|
{
|
||||||
|
if (patom->left)
|
||||||
|
FreeAtom(patom->left);
|
||||||
|
if (patom->right)
|
||||||
|
FreeAtom(patom->right);
|
||||||
|
free(patom->string);
|
||||||
|
free(patom);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
XkbcFreeAllAtoms(void)
|
||||||
|
{
|
||||||
|
if (atomRoot == NULL)
|
||||||
|
return;
|
||||||
|
FreeAtom(atomRoot);
|
||||||
|
atomRoot = NULL;
|
||||||
|
free(nodeTable);
|
||||||
|
nodeTable = NULL;
|
||||||
|
lastAtom = None;
|
||||||
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ authorization from the authors.
|
||||||
#include "xkballoc.h"
|
#include "xkballoc.h"
|
||||||
#include "xkbrules.h"
|
#include "xkbrules.h"
|
||||||
#include "xkbpath.h"
|
#include "xkbpath.h"
|
||||||
|
#include "xkbmisc.h"
|
||||||
#include "parseutils.h"
|
#include "parseutils.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
@ -315,4 +316,5 @@ void
|
||||||
xkb_free_keymap(struct xkb_desc *xkb)
|
xkb_free_keymap(struct xkb_desc *xkb)
|
||||||
{
|
{
|
||||||
XkbcFreeKeyboard(xkb);
|
XkbcFreeKeyboard(xkb);
|
||||||
|
XkbcFreeAllAtoms();
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,9 @@ XkbcNameMatchesPattern(char *name, char *ptrn);
|
||||||
extern char *
|
extern char *
|
||||||
XkbcAtomGetString(uint32_t atom);
|
XkbcAtomGetString(uint32_t atom);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
XkbcFreeAllAtoms(void);
|
||||||
|
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
|
||||||
extern const char *
|
extern const char *
|
||||||
|
|
Loading…
Reference in New Issue