ecore: fix shutdown when using system module.

This patch will detect how many more times ecore_init was called
during initialization and use that as a threshold to do a clean shutdown.
It is a necessary evil as we do have ecore module that will initialize
eldbus that will then reinit ecore_init from within ecore_init and without
a chance for the application to act on it.

I also reenable a test to make sure we will catch earlier this kind of issue.
This commit is contained in:
Cedric BAIL 2013-12-23 11:58:17 +09:00
parent 923459f926
commit 324f4aebe8
2 changed files with 5 additions and 1 deletions

View File

@ -58,6 +58,7 @@ Eo *_ecore_parent = NULL;
static const char *_ecore_magic_string_get(Ecore_Magic m);
static int _ecore_init_count = 0;
static int _ecore_init_count_threshold = 0;
int _ecore_log_dom = -1;
int _ecore_fps_debug = 0;
@ -331,6 +332,8 @@ ecore_init(void)
if (!_no_system_modules)
ecore_system_modules_load();
_ecore_init_count_threshold = _ecore_init_count;
eina_log_timing(_ecore_log_dom,
EINA_LOG_STATE_STOP,
EINA_LOG_STATE_INIT);
@ -375,7 +378,7 @@ ecore_shutdown(void)
_ecore_unlock();
return 0;
}
if (--_ecore_init_count != 0)
if (_ecore_init_count-- != _ecore_init_count_threshold)
goto unlock;
ecore_system_modules_unload();

View File

@ -42,6 +42,7 @@ START_TEST(ecore_test_ecore_init)
fail_if(ret < 1);
ret = ecore_shutdown();
fail_if(ret != 0);
}
END_TEST