e_keyrouter_list: fix crash issue when calling keygrab_unset 28/311428/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 21 May 2024 04:31:35 +0000 (13:31 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Tue, 21 May 2024 05:01:19 +0000 (14:01 +0900)
Change-Id: Ib381a49228ecdbf030bb54887726dc59b437894b
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/bin/inputmgr/e_keyrouter_list.c

index 09a3889..8e2165c 100644 (file)
@@ -1,4 +1,6 @@
 #include "e_keyrouter_intern.h"
+#include "e_input_thread_client_intern.h"
+#include "e_input_backend_intern.h"
 
 #include <tizen-extension-server-protocol.h>
 
@@ -267,12 +269,21 @@ e_keyrouter_find_and_remove_client_from_list(struct wl_resource *surface, struct
      }
 }
 
-void
-e_keyrouter_remove_client_from_list(struct wl_resource *surface, struct wl_client *wc)
+static void
+_e_keyrouter_remove_client_from_list(void *data)
 {
    int i = 0;
    Eina_List *l = NULL, *l_next = NULL;
    E_Keyrouter_Key_List_NodePtr key_node_data = NULL;
+   struct wl_resource *surface;
+   struct wl_client *wc;
+   E_Input_Thread_Request_Keygrab_Data *keygrab_data = data;
+   EINA_SAFETY_ON_NULL_RETURN(keygrab_data);
+
+   surface = keygrab_data->surface;
+   wc = keygrab_data->client;
+
+   INF("[%s] surface(%p), client(%p)\n", __func__, surface, wc);
 
    EINA_SAFETY_ON_TRUE_RETURN(((!surface) && (!wc)));
 
@@ -399,6 +410,19 @@ e_keyrouter_remove_client_from_list(struct wl_resource *surface, struct wl_clien
      }
 }
 
+void
+e_keyrouter_remove_client_from_list(struct wl_resource *surface, struct wl_client *wc)
+{
+   E_Input_Thread_Request_Keygrab_Data keygrab_data;
+   memset(&keygrab_data, 0, sizeof(E_Input_Thread_Request_Keygrab_Data));
+
+   keygrab_data.surface = surface;
+   keygrab_data.client = wc;
+
+   INF("[%s] surface(%p), client(%p)\n", __func__, surface, wc);
+   e_input_backend_thread_safe_call(_e_keyrouter_remove_client_from_list, &keygrab_data, sizeof(E_Input_Thread_Request_Keygrab_Data));
+}
+
 int
 e_keyrouter_find_key_in_list(struct wl_resource *surface, struct wl_client *wc, uint32_t key)
 {