summaryrefslogtreecommitdiff
path: root/src/modules/ecore/system/systemd/ecore_system_systemd.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-12-29 17:06:53 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-12-29 17:06:53 +0900
commit3059859e28d27919e7a51fa1301f59bd983465c4 (patch)
tree47583dfff6cf09f9b24fa20fd7c3ddd8c3c69e1f /src/modules/ecore/system/systemd/ecore_system_systemd.c
parentbd32015dfc13e2a31a250e7046036f81030cfb96 (diff)
Ecore Eldbus: Work around circular dependencies
eldbus initializes ecore that may then init eldbus again, since one of the systemd modules is for eldbus. eldbus_shutdown() is then no longer functional, as there are two refs on eldbus. This patch solves this problem by removing the extra ref on eldbus from the module if it was already initialized. This patch now introduces really bad issues since there are now EO classes that fail to work after module load-unload-reload.
Diffstat (limited to 'src/modules/ecore/system/systemd/ecore_system_systemd.c')
-rw-r--r--src/modules/ecore/system/systemd/ecore_system_systemd.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/modules/ecore/system/systemd/ecore_system_systemd.c b/src/modules/ecore/system/systemd/ecore_system_systemd.c
index 57562224d1..26b08677c3 100644
--- a/src/modules/ecore/system/systemd/ecore_system_systemd.c
+++ b/src/modules/ecore/system/systemd/ecore_system_systemd.c
@@ -11,6 +11,7 @@ static Eldbus_Connection *_conn = NULL;
11 11
12static Eina_List *_objs = NULL; 12static Eina_List *_objs = NULL;
13static Eina_List *_proxies = NULL; 13static Eina_List *_proxies = NULL;
14static Eina_Bool _eldbus_initialized = EINA_FALSE;
14 15
15#ifdef CRI 16#ifdef CRI
16#undef CRI 17#undef CRI
@@ -249,7 +250,22 @@ static void _ecore_system_systemd_shutdown(void);
249static Eina_Bool 250static Eina_Bool
250_ecore_system_systemd_init(void) 251_ecore_system_systemd_init(void)
251{ 252{
252 eldbus_init(); 253 int ref;
254
255 ref = eldbus_init();
256 if (!ref) return EINA_FALSE;
257 if (ref > 1)
258 {
259 // remove extra ref here, otherwise we have a loop like this:
260 // eldbus -> ecore -> (this module) -> eldbus
261 // and neither eldbus nor ecore can't be shutdown
262 _eldbus_initialized = EINA_FALSE;
263 eldbus_shutdown();
264 }
265 else
266 {
267 _eldbus_initialized = EINA_TRUE;
268 }
253 269
254 _log_dom = eina_log_domain_register("ecore_system_systemd", NULL); 270 _log_dom = eina_log_domain_register("ecore_system_systemd", NULL);
255 if (_log_dom < 0) 271 if (_log_dom < 0)
@@ -315,7 +331,9 @@ _ecore_system_systemd_shutdown(void)
315 _log_dom = -1; 331 _log_dom = -1;
316 } 332 }
317 333
318 eldbus_shutdown(); 334 if (_eldbus_initialized)
335 eldbus_shutdown();
336 _eldbus_initialized = EINA_FALSE;
319} 337}
320 338
321EINA_MODULE_INIT(_ecore_system_systemd_init); 339EINA_MODULE_INIT(_ecore_system_systemd_init);