zmike pushed a commit to branch efl-1.22.

http://git.enlightenment.org/core/efl.git/commit/?id=35f39836779c2c08eff78a22883ed5ce53089f09

commit 35f39836779c2c08eff78a22883ed5ce53089f09
Author: Mike Blumenkrantz <zm...@samsung.com>
Date:   Wed May 29 09:31:49 2019 -0400

    ecore-imf/xim: only call ecore_x_shutdown if init was previously called
    
    Summary:
    this isn't a perfect fix, but it's probably the best that can be done
    given the current ecore-imf module api which calls the exit() module
    function unconditionally during module cleanup even if the module was
    never initialized
    
    @fix
    Depends on D9003
    
    Reviewers: cedric
    
    Reviewed By: cedric
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D9005
---
 src/modules/ecore_imf/xim/ecore_imf_xim.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/modules/ecore_imf/xim/ecore_imf_xim.c 
b/src/modules/ecore_imf/xim/ecore_imf_xim.c
index ba5dad58ab..a4d567c376 100644
--- a/src/modules/ecore_imf/xim/ecore_imf_xim.c
+++ b/src/modules/ecore_imf/xim/ecore_imf_xim.c
@@ -130,6 +130,8 @@ static void          _ecore_imf_xim_destroy_cb(XIM xim,
                                               XPointer call_data);
 static void          _ecore_imf_xim_im_setup(XIM_Im_Info *info);
 
+static unsigned int init_count;
+
 static unsigned int
 _ecore_imf_xim_utf8_offset_to_index(const char *str, int offset)
 {
@@ -752,6 +754,7 @@ xim_imf_module_create(void)
 
    if (!ecore_x_init(NULL))
      return NULL;
+   init_count++;
    ctx = ecore_imf_context_new(&xim_class);
    DBG("ctx=%p", ctx);
    return ctx;
@@ -760,7 +763,11 @@ xim_imf_module_create(void)
 static Ecore_IMF_Context *
 xim_imf_module_exit(void)
 {
-   ecore_x_shutdown();
+   if (init_count)
+     {
+        ecore_x_shutdown();
+        init_count--;
+     }
    DBG(" ");
    return NULL;
 }

-- 


Reply via email to