Fix the crash issue when IME is exiting 58/307058/2
authorInhong Han <inhong1.han@samsung.com>
Mon, 4 Mar 2024 09:09:13 +0000 (18:09 +0900)
committerInhong Han <inhong1.han@samsung.com>
Mon, 4 Mar 2024 09:12:28 +0000 (18:12 +0900)
Change-Id: I9b30ab9b8a59214a97ea5ce66950a7cf68941426

src/include/ise-dbus.h
src/ise-dbus.cpp
src/ise.cpp

index 9e97567..b057e69 100644 (file)
@@ -70,6 +70,7 @@ void engine_loader_change_candidate_page_size(uint32_t size);
 void engine_loader_set_candidate_item_layout(std::vector<uint32_t> item);
 void engine_loader_change_candidate_number(uint32_t page_num);
 void engine_loader_long_press_candidate_item(uint32_t index);
+void engine_loader_terminate_ise();
 #ifdef __cplusplus
 }
 #endif
index 0df42ec..909e941 100644 (file)
@@ -32,6 +32,7 @@ static bool is_server_started = false;
 static engine_loader_dbus_info_s *dbus_info = NULL;
 static ISELanguageManager _language_manager;
 static bool _engine_loader_event_done = false;
+static bool _will_terminate = false;
 
 static void _server_appeared_cb(GDBusConnection *connection, const gchar *name, const gchar *name_owner, gpointer user_data)
 {
@@ -855,9 +856,12 @@ void engine_loader_flush_imengine()
     if (!dbus_info || !_send_sync_message(dbus_info->gdbus_connection, g_variant_new("()"), &reply, "flush_imengine"))
         LOGE("Failed to flush imengine");
 
-    double start_time = ecore_time_get();
-    while (!_engine_loader_event_done && (ecore_time_get() - start_time < WAIT_FOR_SYNC_RESPONSE_TIMEOUT))
-        ecore_main_loop_iterate();
+    if (!_will_terminate)
+    {
+        double start_time = ecore_time_get();
+        while (!_engine_loader_event_done && (ecore_time_get() - start_time < WAIT_FOR_SYNC_RESPONSE_TIMEOUT))
+            ecore_main_loop_iterate();
+    }
 }
 
 void engine_loader_reset_imengine()
@@ -868,9 +872,12 @@ void engine_loader_reset_imengine()
     if (!dbus_info || !_send_sync_message(dbus_info->gdbus_connection, g_variant_new("()"), &reply, "reset_imengine"))
         LOGE("Failed to reset imengine");
 
-    double start_time = ecore_time_get();
-    while (!_engine_loader_event_done && (ecore_time_get() - start_time < WAIT_FOR_SYNC_RESPONSE_TIMEOUT))
-        ecore_main_loop_iterate();
+    if (!_will_terminate)
+    {
+        double start_time = ecore_time_get();
+        while (!_engine_loader_event_done && (ecore_time_get() - start_time < WAIT_FOR_SYNC_RESPONSE_TIMEOUT))
+            ecore_main_loop_iterate();
+    }
 }
 
 void engine_loader_send_imengine_event(int command, uint32_t value)
@@ -1081,3 +1088,8 @@ void engine_loader_long_press_candidate_item(uint32_t index)
     if (!dbus_info || !_send_async_message(dbus_info->gdbus_connection, g_variant_new("(u)", index), "long_press_candidate_item"))
         LOGE("Failed to send long pressed item");
 }
+
+void engine_loader_terminate_ise()
+{
+    _will_terminate = true;
+}
index 219125e..30ca013 100644 (file)
@@ -2565,6 +2565,7 @@ static void ime_app_create_cb(void *user_data)
 
 static void ime_app_exit_cb(void *user_data)
 {
+    engine_loader_terminate_ise();
     ise_hide();
     ise_destroy();