Fix mutex lock/unlock pair issues 81/295481/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Fri, 7 Jul 2023 09:38:41 +0000 (18:38 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 10 Jul 2023 06:27:59 +0000 (06:27 +0000)
Change-Id: I3e3938e73acf292b4549ad3267cade0903565e57
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/bin/e_client.c
src/bin/e_comp_wl.c
src/bin/e_comp_wl_input.c
src/bin/e_devicemgr_input.c
src/bin/e_input_evdev.c

index 3e2382e..0713852 100644 (file)
@@ -1237,7 +1237,9 @@ _e_client_free(E_Client *ec)
      {
         ELOGF("COMP", "CRITICAL. focused is deleted ec.", ec);
         ELOGF("FOCUS", "CLIENT FOCUS_SET", NULL);
+        g_mutex_lock(&focused_ec_mutex);
         focused = NULL;
+        g_mutex_unlock(&focused_ec_mutex);
      }
 
    E_OBJECT(ec)->references--;
index f22657a..b75e551 100644 (file)
@@ -5354,6 +5354,7 @@ e_comp_wl_key_down(Ecore_Event_Key *ev, E_Device *dev)
                        DBG("wl_array_add: Out of memory\n");
                        g_mutex_unlock(&e_comp_wl->kbd.keys_mutex);
                        g_mutex_unlock(&e_comp_wl->kbd.focused_mutex);
+                       g_mutex_unlock(&e_comp->input_key_grabs_mutex);
                        return EINA_FALSE;
                     }
                   g_mutex_unlock(&e_comp_wl->kbd.keys_mutex);
@@ -6110,7 +6111,7 @@ e_comp_wl_cursor_hide(E_Client *ec)
    struct wl_resource *surface = e_comp_wl_client_surface_get(ec);
    EINA_SAFETY_ON_NULL_RETURN_VAL(surface, EINA_FALSE);
 
-   if (!!surface) return EINA_FALSE;
+   if (!surface) return EINA_FALSE;
    wc = wl_resource_get_client(surface);
    serial = wl_display_next_serial(e_comp_wl->wl.disp);
    EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res)
index 95683d6..a53e6fa 100644 (file)
@@ -1407,17 +1407,19 @@ e_comp_wl_input_init(void)
    g_mutex_init(&e_comp_wl->xkb.keymap_mutex);
    g_mutex_init(&e_comp_wl->xkb.state_mutex);
 
-   /* get default keyboard repeat rate/delay from configuration */
-   e_comp_wl->kbd.repeat_delay = e_config->keyboard.repeat_delay;
-   e_comp_wl->kbd.repeat_rate = e_config->keyboard.repeat_rate;
-
-   /* check for valid repeat_delay and repeat_rate value */
-   /* if invalid, set the default value of repeat delay and rate value */
    g_mutex_lock(&e_comp_wl->kbd.repeat_delay_mutex);
+   /* get default keyboard repeat delay from configuration */
+   e_comp_wl->kbd.repeat_delay = e_config->keyboard.repeat_delay;
+   /* check for valid repeat_delay */
+   /* if invalid, set the default value of repeat delay */
    if (e_comp_wl->kbd.repeat_delay < 0) e_comp_wl->kbd.repeat_delay = 400;
    g_mutex_unlock(&e_comp_wl->kbd.repeat_delay_mutex);
 
    g_mutex_lock(&e_comp_wl->kbd.repeat_rate_mutex);
+   /* get default keyboard repeat rate from configuration */
+   e_comp_wl->kbd.repeat_rate = e_config->keyboard.repeat_rate;
+   /* check for valid repeat_rate value */
+   /* if invalid, set the default value of repeat rate value */
    if (e_comp_wl->kbd.repeat_rate < 0) e_comp_wl->kbd.repeat_rate = 25;
    g_mutex_unlock(&e_comp_wl->kbd.repeat_rate_mutex);
 
index 88a5720..0470e1e 100644 (file)
@@ -306,7 +306,11 @@ _e_devicemgr_input_device_del(const char *name, const char *identifier, const ch
      e_devicemgr->last_device_touch = NULL;
 
    if (e_devicemgr->last_device_kbd == dev)
-     e_devicemgr->last_device_kbd = NULL;
+     {
+        g_mutex_lock(&e_devicemgr->last_device_kbd_mutex);
+        e_devicemgr->last_device_kbd = NULL;
+        g_mutex_unlock(&e_devicemgr->last_device_kbd_mutex);
+     }
 
    E_FREE(dev);
 }
index 296975f..8f2b58e 100644 (file)
@@ -229,6 +229,7 @@ _device_keyboard_setup(E_Input_Evdev *edev)
    if (!(edev->xkb.state = xkb_state_new(edev->xkb.keymap)))
      {
         g_mutex_unlock(&edev->xkb.state_mutex);
+        g_mutex_unlock(&edev->xkb.keymap_mutex);
         ERR("Failed to create xkb state: %m");
         return;
      }