From cdac1cfc95eb2f84e130cb26a718ea944474c15f Mon Sep 17 00:00:00 2001 From: JengHyun Kang Date: Fri, 16 Dec 2016 15:16:13 +0900 Subject: [PATCH] Deinitialize handlers and hooks Change-Id: I6779e86cd1606c56600d66e54b87c3ff83df51cf --- src/e_mod_main.c | 28 ++++++++++++++++++++++++---- src/e_mod_main.h | 1 + 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index a7c7d95..4f5ca3b 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -358,9 +358,6 @@ _e_gesture_cb_client_focus_in(void *data, int type, void *event) static void _e_gesture_cb_aux_hint_change(void *data EINA_UNUSED, E_Client *ec) { - E_Comp_Wl_Aux_Hint *hint; - Eina_List *l; - if (e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) return; if (!ec->comp_data->aux_hint.changed) return; @@ -378,6 +375,29 @@ _e_gesture_init_handlers(void) gesture->handlers = eina_list_append(gesture->handlers, ecore_event_handler_add(E_EVENT_CLIENT_FOCUS_IN, _e_gesture_cb_client_focus_in, NULL)); + + gesture->hooks = eina_list_append(gesture->hooks, + e_client_hook_add(E_CLIENT_HOOK_AUX_HINT_CHANGE, + _e_gesture_cb_aux_hint_change, NULL)); +} + +static void +_e_gesture_deinit_handlers(void) +{ + Ecore_Event_Handler *event_handler; + E_Client_Hook *hook; + + ecore_event_filter_del(gesture->ef_handler); + + EINA_LIST_FREE(gesture->handlers, event_handler) + { + ecore_event_handler_del(event_handler); + } + + EINA_LIST_FREE(gesture->hooks, hook) + { + e_client_hook_del(hook); + } } static E_Gesture_Config_Data * @@ -440,7 +460,6 @@ _e_gesture_init(E_Module *m) } e_gesture_device_keydev_set(gesture->config->conf->key_device_name); - e_client_hook_add(E_CLIENT_HOOK_AUX_HINT_CHANGE, _e_gesture_cb_aux_hint_change, NULL); gesture->enable = EINA_TRUE; return gconfig; @@ -465,6 +484,7 @@ e_modapi_shutdown(E_Module *m) E_Gesture_Config_Data *gconfig = m->data; e_gesture_conf_deinit(gconfig); e_gesture_device_shutdown(); + _e_gesture_deinit_handlers(); return 1; } diff --git a/src/e_mod_main.h b/src/e_mod_main.h index bd894d5..da12291 100644 --- a/src/e_mod_main.h +++ b/src/e_mod_main.h @@ -159,6 +159,7 @@ struct _E_Gesture Ecore_Event_Filter *ef_handler; Eina_List *handlers; Eina_List *grab_client_list; + Eina_List *hooks; struct { -- 2.7.4