From: Jihoon Kim Date: Tue, 21 May 2024 04:31:35 +0000 (+0900) Subject: e_keyrouter_list: fix crash issue when calling keygrab_unset X-Git-Tag: accepted/tizen/unified/20240521.104311~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F28%2F311428%2F1;p=platform%2Fupstream%2Fenlightenment.git e_keyrouter_list: fix crash issue when calling keygrab_unset Change-Id: Ib381a49228ecdbf030bb54887726dc59b437894b Signed-off-by: Jihoon Kim --- diff --git a/src/bin/inputmgr/e_keyrouter_list.c b/src/bin/inputmgr/e_keyrouter_list.c index 09a3889..8e2165c 100644 --- a/src/bin/inputmgr/e_keyrouter_list.c +++ b/src/bin/inputmgr/e_keyrouter_list.c @@ -1,4 +1,6 @@ #include "e_keyrouter_intern.h" +#include "e_input_thread_client_intern.h" +#include "e_input_backend_intern.h" #include @@ -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) {