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
This commit is contained in:
Mike Blumenkrantz 2019-05-29 09:31:49 -04:00
parent d8debc88f5
commit 35f3983677
1 changed files with 8 additions and 1 deletions

View File

@ -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;
}