From 04f7b59e1178bf51694db6b1897bf35ec9c46664 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Mon, 20 Jan 2014 12:57:28 +0900 Subject: [PATCH] e: call the right function without depending on ld to figure it out (mostly wrongly). As a side note, using an EAPI function from within a module is a call for disaster. Their is no guarantee from ld that it will be the current top open .so, actually it is most likely not going to be the case. So it will do a search for the symbol in the current stack of open .so and the first one to match will be chosen. I do think it basically prove that current model of Enlightenment module is fairly borken and error prone. Hope to have time to fix that, but it will involve completely breaking the API and ABI compatibility of E module. --- src/modules/quickaccess/e_mod_main.c | 32 +++++++++++++---------- src/modules/teamwork/e_mod_main.c | 38 ++++++++++++++++------------ 2 files changed, 41 insertions(+), 29 deletions(-) diff --git a/src/modules/quickaccess/e_mod_main.c b/src/modules/quickaccess/e_mod_main.c index 105495ebc..d2402a18e 100644 --- a/src/modules/quickaccess/e_mod_main.c +++ b/src/modules/quickaccess/e_mod_main.c @@ -25,6 +25,23 @@ Config *qa_config = NULL; EAPI E_Module_Api e_modapi = {E_MODULE_API_VERSION, "Quickaccess"}; ////////////////////////////// +static void +_e_modapi_shutdown(void) +{ + e_qa_shutdown(); + + conf_edd = e_qa_config_dd_free(); + eina_log_domain_unregister(_e_quick_access_log_dom); + _e_quick_access_log_dom = -1; + + e_configure_registry_item_del("launcher/quickaccess"); + e_configure_registry_category_del("launcher"); + + e_qa_config_free(qa_config); + E_FREE(qa_mod); + qa_config = NULL; +} + EAPI void * e_modapi_init(E_Module *m) { @@ -59,7 +76,7 @@ e_modapi_init(E_Module *m) if (!e_qa_init()) { - e_modapi_shutdown(NULL); + _e_modapi_shutdown(); return NULL; } @@ -69,18 +86,7 @@ e_modapi_init(E_Module *m) EAPI int e_modapi_shutdown(E_Module *m __UNUSED__) { - e_qa_shutdown(); - - conf_edd = e_qa_config_dd_free(); - eina_log_domain_unregister(_e_quick_access_log_dom); - _e_quick_access_log_dom = -1; - - e_configure_registry_item_del("launcher/quickaccess"); - e_configure_registry_category_del("launcher"); - - e_qa_config_free(qa_config); - E_FREE(qa_mod); - qa_config = NULL; + _e_modapi_shutdown(); return 1; } diff --git a/src/modules/teamwork/e_mod_main.c b/src/modules/teamwork/e_mod_main.c index 26f4729bf..30f8e8c61 100644 --- a/src/modules/teamwork/e_mod_main.c +++ b/src/modules/teamwork/e_mod_main.c @@ -109,6 +109,26 @@ e_tw_act_toggle_cb(E_Object *obj EINA_UNUSED, const char *params) } } ////////////////////////////// +static void +_e_modapi_shutdown(void) +{ + e_tw_shutdown(); + + E_CONFIG_DD_FREE(conf_edd); + eina_log_domain_unregister(_e_teamwork_log_dom); + _e_teamwork_log_dom = -1; + + e_configure_registry_item_del("applications/teamwork"); + e_configure_registry_category_del("applications"); + + e_action_predef_name_del(_e_tw_name, _lbl_toggle); + e_action_del(_act_toggle); + e_tw_toggle = NULL; + + E_FREE(tw_config); + E_FREE(tw_mod); +} + EAPI void * e_modapi_init(E_Module *m) { @@ -148,7 +168,7 @@ e_modapi_init(E_Module *m) if (!e_tw_init()) { - e_modapi_shutdown(NULL); + _e_modapi_shutdown(); return NULL; } e_tw_toggle = e_action_add(_act_toggle); @@ -161,21 +181,7 @@ e_modapi_init(E_Module *m) EAPI int e_modapi_shutdown(E_Module *m __UNUSED__) { - e_tw_shutdown(); - - E_CONFIG_DD_FREE(conf_edd); - eina_log_domain_unregister(_e_teamwork_log_dom); - _e_teamwork_log_dom = -1; - - e_configure_registry_item_del("applications/teamwork"); - e_configure_registry_category_del("applications"); - - e_action_predef_name_del(_e_tw_name, _lbl_toggle); - e_action_del(_act_toggle); - e_tw_toggle = NULL; - - E_FREE(tw_config); - E_FREE(tw_mod); + _e_modapi_shutdown(); return 1; }