ecore_evas_tbm/wayland: use a cloned eina_list when calling evas_device_del() 77/301077/1 accepted/tizen/unified/20231109.053307
authorduna.oh <duna.oh@samsung.com>
Wed, 8 Nov 2023 04:46:32 +0000 (13:46 +0900)
committerduna.oh <duna.oh@samsung.com>
Wed, 8 Nov 2023 04:46:34 +0000 (13:46 +0900)
Please refer to following two commits

commit 7e239a7e4ba0a2a5937df846aac13bbb5253bf34
Author: duna.oh <duna.oh@samsung.com>
Date:   Mon Feb 20 11:49:37 2023 +0900

    ecore_wl2_input: use a cloned eina_list when calling ecore_device_del()

commit 402abcaefca02973c384d7c37fe543837d566443
Author: Guilherme Iscaro <iscaro@profusion.mobi>
Date:   Tue Nov 1 16:03:52 2016 -0200

    Evas Device: Avoid invalid ptr indirection.
    ...

Change-Id: I2e46ec07caadb8fd79e2df61774be9bf2c44456a

src/modules/ecore_evas/engines/tbm/ecore_evas_tbm.c
src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c

index 46b87ef..e8d251c 100644 (file)
@@ -204,7 +204,7 @@ _ecore_evas_tbm_cb_ecore_device_del(void *data, int type EINA_UNUSED, void *even
 {
    Ecore_Event_Device_Info *ev;
    Ecore_Evas *ee = (Ecore_Evas *)data;
-   Eina_List *list, *l, *l_next;
+   Eina_List *clone;
    Evas_Device *device;
    const char *evas_device_name;
    const char *evas_device_description;
@@ -217,8 +217,8 @@ _ecore_evas_tbm_cb_ecore_device_del(void *data, int type EINA_UNUSED, void *even
 
    evas_cls = _ecore_evas_tbm_ecore_device_class_to_evas(ev->clas);
 
-   list = (Eina_List *)evas_device_list(ee->evas, NULL);
-   EINA_LIST_FOREACH_SAFE(list, l, l_next, device)
+   clone = eina_list_clone(evas_device_list(ee->evas, NULL));
+   EINA_LIST_FREE(clone, device)
      {
         evas_device_name = (char *)evas_device_name_get(device);
         evas_device_description = (char *)evas_device_description_get(device);
index 4cc571c..1f5962d 100644 (file)
@@ -1808,7 +1808,7 @@ _ecore_evas_wl_common_cb_tizen_device_del(void *data EINA_UNUSED, int type EINA_
    Ecore_Wl2_Window *win = NULL;
    Ecore_Wl2_Display *display = NULL;
    Ecore_Evas *ee;
-   Eina_List *list, *l, *ll, *ll_next;
+   Eina_List *clone, *l;
    const char *evas_device_name;
    const char *evas_device_description;
    Evas_Device_Class evas_cls = EVAS_DEVICE_CLASS_NONE;
@@ -1829,8 +1829,8 @@ _ecore_evas_wl_common_cb_tizen_device_del(void *data EINA_UNUSED, int type EINA_
         wdata = ee->engine.data;
         if (display != wdata->display) continue;
 
-        list = (Eina_List *)evas_device_list(ee->evas, NULL);
-        EINA_LIST_FOREACH_SAFE(list, ll, ll_next, device)
+        clone = eina_list_clone(evas_device_list(ee->evas, NULL));
+        EINA_LIST_FREE(clone, device)
           {
              evas_device_name = evas_device_name_get(device);
              evas_device_description = evas_device_description_get(device);