summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInhong Han <inhong1.han@samsung.com>2024-03-04 18:09:13 +0900
committerInhong Han <inhong1.han@samsung.com>2024-03-04 18:12:28 +0900
commit6da63ec0825d628d0d465d5e9ca9016c52b61f39 (patch)
tree6a5655ed3e171de0786b5c9e6bb9d24047e4dabf
parent31e4722bba29f1cfc62a9e651f6ff71d631831b7 (diff)
downloadise-default-6da63ec0825d628d0d465d5e9ca9016c52b61f39.tar.gz
ise-default-6da63ec0825d628d0d465d5e9ca9016c52b61f39.tar.bz2
ise-default-6da63ec0825d628d0d465d5e9ca9016c52b61f39.zip
Fix the crash issue when IME is exiting
Change-Id: I9b30ab9b8a59214a97ea5ce66950a7cf68941426
-rw-r--r--src/include/ise-dbus.h1
-rw-r--r--src/ise-dbus.cpp24
-rw-r--r--src/ise.cpp1
3 files changed, 20 insertions, 6 deletions
diff --git a/src/include/ise-dbus.h b/src/include/ise-dbus.h
index 9e97567..b057e69 100644
--- a/src/include/ise-dbus.h
+++ b/src/include/ise-dbus.h
@@ -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
diff --git a/src/ise-dbus.cpp b/src/ise-dbus.cpp
index 0df42ec..909e941 100644
--- a/src/ise-dbus.cpp
+++ b/src/ise-dbus.cpp
@@ -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;
+}
diff --git a/src/ise.cpp b/src/ise.cpp
index 219125e..30ca013 100644
--- a/src/ise.cpp
+++ b/src/ise.cpp
@@ -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();