devilhorns pushed a commit to branch master.
commit 87c179828117414897d99a2c5308114679420935
Author: Chris Michael <[email protected]>
Date: Thu Jun 27 11:37:51 2013 +0100
leak--: Store xkb_rule_names into Input structure so we can free the strings
on shutdown or keymap change.
Signed-off-by: Chris Michael <[email protected]>
---
src/bin/e_comp_wl.c | 25 +++++++++++++++++--------
src/bin/e_comp_wl.h | 1 +
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c
index 2b3bbe8..744e82b 100644
--- a/src/bin/e_comp_wl.c
+++ b/src/bin/e_comp_wl.c
@@ -74,7 +74,7 @@ static Eina_Bool _e_comp_wl_input_init(void);
static void _e_comp_wl_input_shutdown(void);
static void _e_comp_wl_input_cb_bind(struct wl_client *client, void *data,
unsigned int version EINA_UNUSED, unsigned int id);
static void _e_comp_wl_input_cb_unbind(struct wl_resource *resource);
-static struct xkb_keymap *_e_comp_wl_input_keymap_get(void);
+static struct xkb_keymap *_e_comp_wl_input_keymap_get(E_Wayland_Input *input);
static int _e_comp_wl_input_keymap_fd_get(off_t size);
static E_Wayland_Keyboard_Info *_e_comp_wl_input_keyboard_info_get(struct
xkb_keymap *keymap);
@@ -1513,12 +1513,18 @@ _e_comp_wl_cb_keymap_changed(void *data EINA_UNUSED,
int type EINA_UNUSED, void
struct xkb_keymap *keymap;
/* try to fetch the keymap */
- if (!(keymap = _e_comp_wl_input_keymap_get()))
+ if (!(keymap = _e_comp_wl_input_keymap_get(_e_wl_comp->input)))
return ECORE_CALLBACK_PASS_ON;
/* destroy keyboard */
if (_e_wl_comp->input->xkb.info)
{
+ free((char *)_e_wl_comp->input->xkb.names.rules);
+ free((char *)_e_wl_comp->input->xkb.names.model);
+ free((char *)_e_wl_comp->input->xkb.names.layout);
+ free((char *)_e_wl_comp->input->xkb.names.variant);
+ free((char *)_e_wl_comp->input->xkb.names.options);
+
/* if we have a keymap, unreference it */
if (_e_wl_comp->input->xkb.info->keymap)
xkb_map_unref(_e_wl_comp->input->xkb.info->keymap);
@@ -1762,7 +1768,7 @@ _e_comp_wl_input_init(void)
_e_wl_comp->xkb.context = xkb_context_new(0);
/* try to fetch the keymap */
- if ((keymap = _e_comp_wl_input_keymap_get()))
+ if ((keymap = _e_comp_wl_input_keymap_get(_e_wl_comp->input)))
{
/* try to create new keyboard info */
_e_wl_comp->input->xkb.info =
@@ -1816,6 +1822,12 @@ _e_comp_wl_input_shutdown(void)
/* destroy keyboard */
if (_e_wl_comp->input->xkb.info)
{
+ free((char *)_e_wl_comp->input->xkb.names.rules);
+ free((char *)_e_wl_comp->input->xkb.names.model);
+ free((char *)_e_wl_comp->input->xkb.names.layout);
+ free((char *)_e_wl_comp->input->xkb.names.variant);
+ free((char *)_e_wl_comp->input->xkb.names.options);
+
/* if we have a keymap, unreference it */
if (_e_wl_comp->input->xkb.info->keymap)
xkb_map_unref(_e_wl_comp->input->xkb.info->keymap);
@@ -1893,7 +1905,7 @@ _e_comp_wl_input_cb_unbind(struct wl_resource *resource)
}
static struct xkb_keymap *
-_e_comp_wl_input_keymap_get(void)
+_e_comp_wl_input_keymap_get(E_Wayland_Input *input)
{
E_Config_XKB_Layout *kbd_layout;
struct xkb_rule_names names;
@@ -1940,10 +1952,7 @@ _e_comp_wl_input_keymap_get(void)
}
}
- printf("Keymap\n");
- printf("\tRules: %s\n", names.rules);
- printf("\tModel: %s\n", names.model);
- printf("\tLayout: %s\n", names.layout);
+ input->xkb.names = names;
return xkb_map_new_from_names(_e_wl_comp->xkb.context, &names, 0);
}
diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h
index 8479b40..de0e31e 100644
--- a/src/bin/e_comp_wl.h
+++ b/src/bin/e_comp_wl.h
@@ -421,6 +421,7 @@ struct _E_Wayland_Input
{
E_Wayland_Keyboard_Info *info;
struct xkb_state *state;
+ struct xkb_rule_names names;
} xkb;
struct
--
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev