ecore_wl2_input: use a cloned eina_list when calling ecore_device_del() 52/288552/3
authorduna.oh <duna.oh@samsung.com>
Mon, 20 Feb 2023 02:49:37 +0000 (11:49 +0900)
committerduna.oh <duna.oh@samsung.com>
Wed, 22 Feb 2023 02:01:50 +0000 (11:01 +0900)
Change-Id: I14e54a246f3937af88f831813e685df26e09fea1

src/lib/ecore_wl2/ecore_wl2_input.c

index e577ad0..37f413e 100644 (file)
@@ -3373,12 +3373,14 @@ static Eina_Bool
 _ecore_wl2_input_device_ecore_device_remove(Ecore_Wl2_Tizen_Input_Device *dev)
 {
    Ecore_Device *ecdev;
-   const Eina_List *l;
+   Eina_List *l, *clone;
    const char *ecdev_name;
 
    if (!dev->identifier) return EINA_FALSE;
 
-   EINA_LIST_FOREACH(ecore_device_list(), l, ecdev)
+   clone = eina_list_clone(ecore_device_list());
+
+   EINA_LIST_FOREACH(clone, l, ecdev)
      {
         ecdev_name = ecore_device_identifier_get(ecdev);
         if (!ecdev_name) continue;
@@ -3388,9 +3390,11 @@ _ecore_wl2_input_device_ecore_device_remove(Ecore_Wl2_Tizen_Input_Device *dev)
               efl_unref(dev->device);
               ecore_device_del(ecdev);
               dev->device = NULL;
+              eina_list_free(clone);
               return EINA_TRUE;
            }
       }
+    eina_list_free(clone);
 
     return EINA_FALSE;
 }