From 58a2857868c7014c77e15c18c22c4f9094de74ae Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Fri, 23 Apr 2021 17:42:16 +0900 Subject: [PATCH] atspi: recover init failure There is an application which is trying to init atspi bridge before DBus is ready. In this case, it is not able to create atspi bridge instance. Change-Id: Ie5a0b37ddb814ded90d4e205ef0ccedc9c85c932 --- src/lib/elementary/elm_atspi_bridge.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/lib/elementary/elm_atspi_bridge.c b/src/lib/elementary/elm_atspi_bridge.c index a81e6da..3ddae2b 100644 --- a/src/lib/elementary/elm_atspi_bridge.c +++ b/src/lib/elementary/elm_atspi_bridge.c @@ -164,6 +164,9 @@ struct collection_match_rule { }; static Eo *_instance; +//TIZEN_ONLY(20210423): recover init failure +static Ecore_Idler *_init_idler = NULL; +// static int _init_count = 0; //TIZEN_ONLY(20171108): make atspi_proxy work static const char *_a11y_socket_address; @@ -7129,12 +7132,38 @@ static void _bridge_object_register(Eo *bridge, Eo *obj) eina_hash_add(pd->cache, &obj, obj); } +//TIZEN_ONLY(20210423): recover init failure +static Eina_Bool +_init_job(void *data) +{ + _instance = efl_add_ref(ELM_ATSPI_BRIDGE_CLASS, NULL); + _init_count++; + + /* try to create bridge object 10 times */ + if (_instance || _init_count > 10) + { + _init_idler = NULL; + return ECORE_CALLBACK_CANCEL; + } + + return ECORE_CALLBACK_RENEW; +} +// + void _elm_atspi_bridge_init(void) { if (!_init_count) { _instance = efl_add_ref(ELM_ATSPI_BRIDGE_CLASS, NULL); + + //TIZEN_ONLY(20210423): recover init failure + if (!_instance) + { + _init_idler = ecore_idler_add(_init_job, NULL); + } + // + _init_count = 1; } } @@ -7150,6 +7179,9 @@ _elm_atspi_bridge_shutdown(void) { if (_init_count) { + //TIZEN_ONLY(20210423): recover init failure + if (_init_idler) ecore_idler_del(_init_idler); + // efl_unref(_instance); _init_count = 0; _instance = NULL; -- 2.7.4