From: Jihoon Kim Date: Fri, 23 May 2025 11:47:23 +0000 (+0900) Subject: e_comp_wl_input: fix data race issue of kbd.enabled X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=df0d7c90575d1cedb8f0fb20dd0f143c115467c9;p=platform%2Fupstream%2Fenlightenment.git e_comp_wl_input: fix data race issue of kbd.enabled e_comp_input_key->kbd.enabled variable is used in only main thread Change-Id: I2ba66597123b77d2f271057b6f3003a089dc9721 Signed-off-by: Jihoon Kim --- diff --git a/src/bin/e_comp_screen.c b/src/bin/e_comp_screen.c index 61e324cc19..a3592502c4 100644 --- a/src/bin/e_comp_screen.c +++ b/src/bin/e_comp_screen.c @@ -172,11 +172,9 @@ _e_comp_screen_cb_input_device_add(void *data, int type, void *event) } else if (e->clas == ECORE_DEVICE_CLASS_KEYBOARD) { - if (!e_input_thread_mode_get()) - { - e_comp_input_key->kbd.num_devices++; - e_comp_wl_input_keyboard_enabled_set(EINA_TRUE); - } + e_comp_input_key->kbd.num_devices++; + if (e_comp_input_key->kbd.num_devices == 1) + e_comp_wl_input_keyboard_enabled_set(EINA_TRUE); } else if (e->clas == ECORE_DEVICE_CLASS_TOUCH) { @@ -248,6 +246,14 @@ _e_comp_screen_cb_input_device_del(void *data, int type, void *event) _e_comp_screen_pointer_renew(); } } + else if (e->clas == ECORE_DEVICE_CLASS_KEYBOARD) + { + e_comp_input_key->kbd.num_devices--; + if (e_comp_input_key->kbd.num_devices == 0) + { + e_comp_wl_input_keyboard_enabled_set(EINA_FALSE); + } + } else if (e->clas == ECORE_DEVICE_CLASS_TOUCH) { comp_wl->touch.num_devices--; diff --git a/src/bin/inputmgr/e_input_backend.c b/src/bin/inputmgr/e_input_backend.c index acbafb2e2b..a844df88a2 100644 --- a/src/bin/inputmgr/e_input_backend.c +++ b/src/bin/inputmgr/e_input_backend.c @@ -378,15 +378,6 @@ _e_input_add_ecore_device(E_Input_Evdev *evdev, Ecore_Device_Class clas, Ecore_D e_device_class_set(e_dev, clas); e_device_subclass_set(e_dev, subclas); - if (e_input_thread_mode_get()) - { - if (clas == ECORE_DEVICE_CLASS_KEYBOARD) - { - e_comp_input_key->kbd.num_devices++; - e_comp_wl_input_keyboard_enabled_set(EINA_TRUE); - } - } - if (!evdev->e_dev) { if (!evdev->e_dev_list || (g_list_length(evdev->e_dev_list) == 0)) @@ -501,13 +492,6 @@ _e_input_remove_ecore_device(E_Input_Evdev *evdev, Ecore_Device_Class clas) if ((e_device_class_get(device) == clas) && (!strcmp(device_identifier, evdev->path))) { - if (clas == ECORE_DEVICE_CLASS_KEYBOARD) - { - e_comp_input_key->kbd.num_devices--; - if (e_comp_input_key->kbd.num_devices == 0) - e_comp_wl_input_keyboard_enabled_set(EINA_FALSE); - } - device_remove_log = eina_stringshare_printf("[Remove Device] device name(%s), identifier(%s), class(%s), subclass(%d)", e_device_name_get(device), device_identifier, diff --git a/src/bin/server/e_comp_wl_input.c b/src/bin/server/e_comp_wl_input.c index 0203af410c..83d1cdfaa0 100644 --- a/src/bin/server/e_comp_wl_input.c +++ b/src/bin/server/e_comp_wl_input.c @@ -1995,17 +1995,6 @@ e_comp_wl_input_pointer_enabled_set(Eina_Bool enabled) _e_comp_wl_input_update_seat_caps(comp_wl, NULL); } -static void -_e_comp_wl_input_thread_cb_keyboard_enabled_set(void *data) -{ - Eina_Bool enabled; - EINA_SAFETY_ON_NULL_RETURN(data); - - enabled = *(Eina_Bool *)data; - - e_comp_input_key->kbd.enabled = !!enabled; -} - EINTERN void e_comp_wl_input_keyboard_enabled_set(Eina_Bool enabled) { @@ -2017,7 +2006,7 @@ e_comp_wl_input_keyboard_enabled_set(Eina_Bool enabled) return; } - e_input_backend_thread_safe_call(_e_comp_wl_input_thread_cb_keyboard_enabled_set, &enabled, sizeof(Eina_Bool)); + e_comp_input_key->kbd.enabled = !!enabled; _e_comp_wl_input_update_seat_caps(comp_wl, NULL); }