access: do not count initted if elm_modapi_init() is fail 75/104075/2
authorJonghee Choi <joi.choi@samsung.com>
Thu, 8 Dec 2016 04:28:39 +0000 (13:28 +0900)
committerHermet Park <chuneon.park@samsung.com>
Tue, 13 Dec 2016 00:28:24 +0000 (16:28 -0800)
Summary:
When _access_init was called, initted will be increased always even though failed to initialize.
This patch will fix this problem.

Signed-off-by: Jonghee Choi <joi.choi@samsung.com>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
Reviewers: cedric, Hermet

Reviewed By: Hermet

Subscribers: joi.choi, jpeg

Differential Revision: https://phab.enlightenment.org/D4466

Change-Id: I4e36a24cbe4a42cb5e491681d3f81807bb74490e

src/lib/elm_access.c

index 037a9a1..97e8a1c 100644 (file)
@@ -163,12 +163,14 @@ static void
 _access_init(void)
 {
    Elm_Module *m;
-   initted++;
-   if (initted > 1) return;
+
+   if (initted > 0) return;
    if (!(m = _elm_module_find_as("access/api"))) return;
+   if (m->init_func(m) < 0) return;
+   initted++;
+
    m->api = malloc(sizeof(Mod_Api));
    if (!m->api) return;
-   m->init_func(m);
    ((Mod_Api *)(m->api)      )->out_read = // called to read out some text
       _elm_module_symbol_get(m, "out_read");
    ((Mod_Api *)(m->api)      )->out_read_done = // called to set a done marker so when it is reached the done callback is called