From 374aa0327ac2f39e450d12acd4ab5f30fad8bf3a Mon Sep 17 00:00:00 2001 From: InHong Han Date: Wed, 8 Mar 2017 21:50:19 +0900 Subject: [PATCH] Added the free callback function to prevent memory leak Change-Id: Iedada3ed40c91e0f4632f9a04a30fbeea989c161 --- ism/extras/wayland_immodule/wayland_imcontext.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/ism/extras/wayland_immodule/wayland_imcontext.c b/ism/extras/wayland_immodule/wayland_imcontext.c index c8102a4..fca7184 100644 --- a/ism/extras/wayland_immodule/wayland_imcontext.c +++ b/ism/extras/wayland_immodule/wayland_imcontext.c @@ -890,6 +890,13 @@ _send_input_panel_hide_request(Ecore_IMF_Context *ctx) } } +static void _conformant_area_free (void *data EINA_UNUSED, void *ev) +{ + Ecore_Wl_Event_Conformant_Change *e = ev; + free(e); + e = NULL; +} + static Eina_Rectangle _conformant_area_backup = { 0, 0, 0, 0 }; static Eina_Bool reset_conformant_area(Ecore_IMF_Context *ctx) { @@ -929,7 +936,7 @@ static Eina_Bool reset_conformant_area(Ecore_IMF_Context *ctx) ev->win = ecore_wl_window_id_get(window); ev->part_type = 1; ev->state = 0; - ecore_event_add(ECORE_WL_EVENT_CONFORMANT_CHANGE, ev, NULL, NULL); + ecore_event_add(ECORE_WL_EVENT_CONFORMANT_CHANGE, ev, _conformant_area_free, NULL); } _conformant_reset_started = EINA_TRUE; @@ -974,7 +981,7 @@ static void restore_conformant_area(Ecore_IMF_Context *ctx) ev->win = ecore_wl_window_id_get(window); ev->part_type = 1; ev->state = 0; - ecore_event_add(ECORE_WL_EVENT_CONFORMANT_CHANGE, ev, NULL, NULL); + ecore_event_add(ECORE_WL_EVENT_CONFORMANT_CHANGE, ev, _conformant_area_free, NULL); } _conformant_reset_started = EINA_FALSE; } @@ -1848,6 +1855,14 @@ text_input_modifiers_map(void *data, } static void +_ecore_keyevent_free (void *data EINA_UNUSED, void *ev) +{ + Ecore_Event_Key *e = ev; + free(e); + e = NULL; +} + +static void text_input_keysym(void *data, struct wl_text_input *text_input EINA_UNUSED, uint32_t serial EINA_UNUSED, @@ -1919,9 +1934,9 @@ text_input_keysym(void *data, } else { if (state) - ecore_event_add(ECORE_EVENT_KEY_DOWN, e, NULL, NULL); + ecore_event_add(ECORE_EVENT_KEY_DOWN, e, _ecore_keyevent_free, NULL); else - ecore_event_add(ECORE_EVENT_KEY_UP, e, NULL, NULL); + ecore_event_add(ECORE_EVENT_KEY_UP, e, _ecore_keyevent_free, NULL); } } -- 2.7.4