From: Shinwoo Kim Date: Sat, 27 Jul 2013 05:36:35 +0000 (+0900) Subject: [screen-reader] resolve shutdown issue caused by imporper module data X-Git-Tag: 2.2_release~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=21e22d93281b041b096ea29801a51b2faa8cead0;p=platform%2Fcore%2Fuifw%2Fe17-extra-modules.git [screen-reader] resolve shutdown issue caused by imporper module data Change-Id: I2c40bef035aa064b46faa0dffbe8186243659bb6 --- diff --git a/screen-reader/src/e_mod_config.c b/screen-reader/src/e_mod_config.c index 0a3bd47..7a5ba63 100644 --- a/screen-reader/src/e_mod_config.c +++ b/screen-reader/src/e_mod_config.c @@ -2,83 +2,6 @@ #include "e_mod_main.h" #include "e_mod_config.h" -struct _E_Config_Dialog_Data -{ - int dummy; -}; - -/* local function prototypes */ -static void *_create_data (E_Config_Dialog *cfd); -static void _fill_data (E_Config_Dialog_Data *cfdata); -static void _free_data (E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata); -static Evas_Object *_basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata); -static int _basic_apply (E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata); - -void -_config_pager_module(void) -{ - E_Config_Dialog_View *v; - E_Container *con; - - if (e_config_dialog_find("E", "_e_mod_access_config_dialog")) - return; - v = E_NEW(E_Config_Dialog_View, 1); - if (!v) return; - - v->create_cfdata = _create_data; - v->free_cfdata = _free_data; - v->basic.create_widgets = _basic_create; - v->basic.apply_cfdata = _basic_apply; - - con = e_container_current_get(e_manager_current_get()); - e_config_dialog_new(con, "Screen Readers Settings", "E", - "_e_mod_access_config_dialog", - "preferences-desktop-access", 0, v, NULL); -} - -/* local function prototypes */ -static void * -_create_data(E_Config_Dialog *cfd __UNUSED__) -{ - E_Config_Dialog_Data *cfdata; - - cfdata = E_NEW(E_Config_Dialog_Data, 1); - _fill_data(cfdata); - return cfdata; -} - -static void -_fill_data(E_Config_Dialog_Data *cfdata) -{ - cfdata->dummy = 1; -} - -static void -_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) -{ - E_FREE(cfdata); -} - -static Evas_Object * -_basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata __UNUSED__) -{ - Evas_Object *ol, *of; - - ol = e_widget_list_add(evas, 0, 0); - - of = e_widget_framelist_add(evas, "General", 0); - e_widget_list_object_append(ol, of, 1, 0, 0.5); - - return ol; -} - -static int -_basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata __UNUSED__) -{ - e_config_save_queue(); - return 1; -} - EAPI void e_mod_screen_reader_cfdata_edd_init(E_Config_DD **conf_edd) { @@ -89,6 +12,8 @@ e_mod_screen_reader_cfdata_edd_init(E_Config_DD **conf_edd) #define T Config #define D *conf_edd E_CONFIG_VAL(D, T, three_finger_swipe_timeout, INT); +#undef T +#undef D } EAPI Config * @@ -106,10 +31,5 @@ e_mod_screen_reader_cfdata_config_new(void) EAPI void e_mod_screen_reader_cfdata_config_free(Config *cfg) { - if (cfg) - { - memset(cfg, 0, sizeof(Config)); - free(cfg); - cfg = NULL; - } + if (cfg) E_FREE(cfg); } diff --git a/screen-reader/src/e_mod_main.c b/screen-reader/src/e_mod_main.c index 0f9200c..73c31ea 100644 --- a/screen-reader/src/e_mod_main.c +++ b/screen-reader/src/e_mod_main.c @@ -1389,7 +1389,6 @@ _e_mod_config_free(E_Module *m) Mod *mod = m->data; e_mod_screen_reader_cfdata_config_free(mod->conf); - mod->conf = NULL; } /***************************************************************************/ /* module setup */ @@ -1403,7 +1402,7 @@ e_modapi_init(E_Module *m) { Mod *mod; - mod = calloc(1, sizeof(Mod)); + mod = E_NEW(Mod, 1); m->data = mod; e_mod_screen_reader_cfdata_edd_init(&(mod->conf_edd)); mod->conf = e_config_domain_load("module.screen-reader-tizen", mod->conf_edd); @@ -1463,13 +1462,20 @@ e_modapi_shutdown(E_Module *m) Mod *mod = m->data; - if (mod == _screen_reader_mod) _screen_reader_mod = NULL; - _e_mod_config_free(m); - E_CONFIG_DD_FREE(mod->conf_edd); + if (mod && mod == _screen_reader_mod) + { + _screen_reader_mod = NULL; - memset(mod, 0, sizeof(Mod)); - free(mod); - mod = NULL; + _e_mod_config_free(m); + E_CONFIG_DD_FREE(mod->conf_edd); + E_FREE(mod); + } + else + { + ERR("[screen-reader] module data is not proper. " + "Expected: %p, Supplied: %p", + _screen_reader_mod, mod); + } return 1; }