Fixed the deadlock issue 17/218117/2
authorInHong Han <inhong1.han@samsung.com>
Tue, 19 Nov 2019 10:44:22 +0000 (19:44 +0900)
committerInHong Han <inhong1.han@samsung.com>
Wed, 20 Nov 2019 07:21:35 +0000 (16:21 +0900)
To prevent the deadlock issue, the process_key_event_done() should be called right away when the IME is terminated.

Change-Id: I4e0badaa44acd29d9f341b5aef279dfd556bf854

ism/src/isf_info_manager.cpp

index d221678..af36973 100644 (file)
@@ -281,6 +281,7 @@ class InfoManager::InfoManagerImpl
     bool                                m_refocus_needed;
     bool                                m_reshow_needed;
     bool                                m_restart_needed;
+    bool                                m_is_ise_alive;
 
     std::vector<int>                    m_current_send_remoteinput_id;
     std::vector<int>                    m_current_recv_remoteinput_id;
@@ -442,6 +443,7 @@ public:
           m_refocus_needed (false),
           m_reshow_needed (false),
           m_restart_needed (true),
+          m_is_ise_alive (false),
           m_last_socket_client (-1), m_last_client_context (0),
           m_ise_context_buffer (NULL), m_ise_context_length (0),
           m_imdata_buffer (NULL), m_imdata_length (0) {
@@ -1565,6 +1567,9 @@ public:
     bool process_key_event (KeyEvent& key, uint32 serial, uint32 keycode) {
         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
 
+        if (m_is_ise_alive == false)
+            return false;
+
         if (it != m_helper_client_index.end ()) {
             int    client;
             uint32 context;
@@ -2762,6 +2767,9 @@ public:
         lock ();
         m_client_repository [client_id] = info;
 
+        if (info.type == HELPER_CLIENT || info.type == HELPER_ACT_CLIENT)
+            m_is_ise_alive = true;
+
         if (info.type == IMCONTROL_ACT_CLIENT) {
             m_pending_active_imcontrol_id = client_id;
         } else if (info.type == IMCONTROL_CLIENT) {
@@ -2961,8 +2969,12 @@ public:
             lock ();
             HelperInfoRepository::iterator hiit = m_helper_active_info_repository.find (client_id);
 
-            if (hiit != m_helper_active_info_repository.end ())
+            if (hiit != m_helper_active_info_repository.end ()) {
+                if (hiit->second.uuid == m_current_helper_uuid)
+                    m_is_ise_alive = false;
+
                 m_helper_active_info_repository.erase (hiit);
+            }
 
             unlock ();
         } else if (client_info.type == IMCONTROL_ACT_CLIENT) {