Fixed the crash issue when the ecore_wl_shutdown() is called without init 48/142048/1
authorInHong Han <inhong1.han@samsung.com>
Wed, 2 Aug 2017 09:56:50 +0000 (18:56 +0900)
committerInHong Han <inhong1.han@samsung.com>
Wed, 2 Aug 2017 09:57:16 +0000 (18:57 +0900)
Change-Id: I334bdc1144b00a765a3c59ac7b3669f6548228a0

ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp

index 519654c..f95e8cb 100644 (file)
@@ -211,6 +211,7 @@ static bool                                             read_devices = false;
 
 static bool                                             _need_wl_im_init           = false;
 static struct _wl_im                                    *_wl_im_ctx                = NULL;
+static int                                              _ecore_wl_init_count       = 0;
 
 #define WAYLAND_MODULE_CLIENT_ID (0)
 #define MAX_PREEDIT_BUFSIZE 4000
@@ -1169,7 +1170,7 @@ isf_wsc_context_init (void)
     LOGD ("");
 
     if (!_scim_initialized) {
-        ecore_wl_init (NULL);
+        _ecore_wl_init_count = ecore_wl_init (NULL);
         initialize ();
         _scim_initialized = true;
         isf_wsc_input_panel_init ();
@@ -1188,7 +1189,11 @@ isf_wsc_context_shutdown (void)
 
         isf_wsc_input_panel_shutdown ();
         finalize ();
-        ecore_wl_shutdown ();
+
+        if (_ecore_wl_init_count > 0) {
+            ecore_wl_shutdown ();
+            _ecore_wl_init_count = 0;
+        }
     }
 }