summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@samsung.com>2013-12-23 11:58:17 +0900
committerCedric BAIL <cedric.bail@samsung.com>2013-12-23 11:58:17 +0900
commit324f4aebe8f42a1b9888760765c2f06c83c95726 (patch)
treebc11e002228641aa2c59184459853dd333d06b6b /src
parent923459f92692860c15a0ca351ca6cbb26ad999d3 (diff)
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.
Diffstat (limited to '')
-rw-r--r--src/lib/ecore/ecore.c5
-rw-r--r--src/tests/ecore/ecore_test_ecore.c1
2 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c
index d9c194c77f..58702060ee 100644
--- a/src/lib/ecore/ecore.c
+++ b/src/lib/ecore/ecore.c
@@ -58,6 +58,7 @@ Eo *_ecore_parent = NULL;
58 58
59static const char *_ecore_magic_string_get(Ecore_Magic m); 59static const char *_ecore_magic_string_get(Ecore_Magic m);
60static int _ecore_init_count = 0; 60static int _ecore_init_count = 0;
61static int _ecore_init_count_threshold = 0;
61int _ecore_log_dom = -1; 62int _ecore_log_dom = -1;
62int _ecore_fps_debug = 0; 63int _ecore_fps_debug = 0;
63 64
@@ -331,6 +332,8 @@ ecore_init(void)
331 if (!_no_system_modules) 332 if (!_no_system_modules)
332 ecore_system_modules_load(); 333 ecore_system_modules_load();
333 334
335 _ecore_init_count_threshold = _ecore_init_count;
336
334 eina_log_timing(_ecore_log_dom, 337 eina_log_timing(_ecore_log_dom,
335 EINA_LOG_STATE_STOP, 338 EINA_LOG_STATE_STOP,
336 EINA_LOG_STATE_INIT); 339 EINA_LOG_STATE_INIT);
@@ -375,7 +378,7 @@ ecore_shutdown(void)
375 _ecore_unlock(); 378 _ecore_unlock();
376 return 0; 379 return 0;
377 } 380 }
378 if (--_ecore_init_count != 0) 381 if (_ecore_init_count-- != _ecore_init_count_threshold)
379 goto unlock; 382 goto unlock;
380 383
381 ecore_system_modules_unload(); 384 ecore_system_modules_unload();
diff --git a/src/tests/ecore/ecore_test_ecore.c b/src/tests/ecore/ecore_test_ecore.c
index f3b260a4d2..08a00e2e27 100644
--- a/src/tests/ecore/ecore_test_ecore.c
+++ b/src/tests/ecore/ecore_test_ecore.c
@@ -42,6 +42,7 @@ START_TEST(ecore_test_ecore_init)
42 fail_if(ret < 1); 42 fail_if(ret < 1);
43 43
44 ret = ecore_shutdown(); 44 ret = ecore_shutdown();
45 fail_if(ret != 0);
45} 46}
46END_TEST 47END_TEST
47 48