diff options
author | Lukasz Stanislawski <l.stanislaws@samsung.com> | 2016-02-19 17:35:29 +0100 |
---|---|---|
committer | Michal Pawluk <m.pawluk@samsung.com> | 2016-03-09 04:26:31 -0800 |
commit | 84361427ad8b2b92d63da607aeacbf4173893731 (patch) | |
tree | e45ab0cefd3f87a4ff3c941ff2cc4d9a79b10659 | |
parent | 4d1a0f97a80f5375307f5a1fcd52214c53c216c2 (diff) | |
download | indicator-win-84361427ad8b2b92d63da607aeacbf4173893731.tar.gz indicator-win-84361427ad8b2b92d63da607aeacbf4173893731.tar.bz2 indicator-win-84361427ad8b2b92d63da607aeacbf4173893731.zip |
modules: check init function return values.
Previously return values of modules initi functions were not checked.
Change-Id: Ia444cfe8fe835c2efbfb7faf26866e54ef6018e0
Signed-off-by: Lukasz Stanislawski <l.stanislaws@samsung.com>
-rw-r--r-- | inc/indicator.h | 1 | ||||
-rw-r--r-- | src/modules/modules.c | 28 |
2 files changed, 16 insertions, 13 deletions
diff --git a/inc/indicator.h b/inc/indicator.h index 642bc5a..e4029fa 100644 --- a/inc/indicator.h +++ b/inc/indicator.h @@ -214,6 +214,7 @@ typedef struct Indicator_Icon { int tts_enable; #endif int digit_area; + Eina_Bool initialized; /* TRUE is module was correctly intiialized */ } icon_s; //int rssi_get_sim_number(TapiHandle *handle_obj); diff --git a/src/modules/modules.c b/src/modules/modules.c index f3f41e8..8cdc93c 100644 --- a/src/modules/modules.c +++ b/src/modules/modules.c @@ -132,9 +132,9 @@ void modules_init(void *data) for (i = 0; modules[i]; i++) { list_insert_icon(modules[i]); modules[i]->ad = data; - if (modules[i]->init) - { - modules[i]->init(data); + if (modules[i]->init && !modules[i]->initialized) { + if (modules[i]->init(data) == OK) + modules[i]->initialized = EINA_TRUE; } } } @@ -148,9 +148,9 @@ void modules_init_first(void *data) for (i = 0; i < 5; i++) { list_insert_icon(modules[i]); modules[i]->ad = data; - if (modules[i]->init) - { - modules[i]->init(data); + if (modules[i]->init && !modules[i]->initialized) { + if (modules[i]->init(data) == OK) + modules[i]->initialized = EINA_TRUE; } } } @@ -162,8 +162,10 @@ void modules_fini(void *data) int i; /* add items to list */ for (i = 0; modules[i]; i++) { - if (modules[i]->fini) - modules[i]->fini(); + if (modules[i]->fini && modules[i]->initialized) { + if (modules[i]->fini() == OK) + modules[i]->initialized = EINA_FALSE; + } } /* delete modules */ @@ -177,7 +179,7 @@ void modules_lang_changed(void *data) int i; /* add items to list */ for (i = 0; modules[i]; i++) { - if (modules[i]->lang_changed) + if (modules[i]->lang_changed && modules[i]->initialized) modules[i]->lang_changed(data); } } @@ -189,7 +191,7 @@ void modules_region_changed(void *data) int i; /* add items to list */ for (i = 0; modules[i]; i++) { - if (modules[i]->region_changed) + if (modules[i]->region_changed && modules[i]->initialized) modules[i]->region_changed(data); } } @@ -201,7 +203,7 @@ void modules_minictrl_control(int action, const char* name, void *data) int i; /* add items to list */ for (i = 0; modules[i]; i++) { - if (modules[i]->minictrl_control) + if (modules[i]->minictrl_control && modules[i]->initialized) modules[i]->minictrl_control(action, name, data); } } @@ -213,7 +215,7 @@ void modules_wake_up(void *data) int i; /* add items to list */ for (i = 0; modules[i]; i++) { - if (modules[i]->wake_up) + if (modules[i]->wake_up && modules[i]->initialized) modules[i]->wake_up(data); } } @@ -227,7 +229,7 @@ void modules_register_tts(void *data) /* add items to list */ for (i = 0; modules[i]; i++) { modules[i]->ad = data; - if (modules[i]->register_tts) + if (modules[i]->register_tts && modules[i]->initialized) { modules[i]->register_tts(data); } |