evas - handle devices that on deletion delete other devices on shutdown
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Mon, 31 Jul 2017 06:07:28 +0000 (15:07 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Mon, 31 Jul 2017 06:07:28 +0000 (15:07 +0900)
this fixes a whole bunch of warnings that just recently turned up...

src/lib/evas/canvas/evas_device.c
src/lib/evas/include/evas_private.h

index d352b3c..7f93b77 100644 (file)
@@ -78,6 +78,7 @@ _del_cb(void *data, const Efl_Event *ev)
 {
    Evas_Public_Data *e = data;
 
+   e->devices_modified = EINA_TRUE;
    // can not be done in std destructor
    e->devices = eina_list_remove(e->devices, ev->object);
 
@@ -473,9 +474,18 @@ _evas_device_cleanup(Evas *eo_e)
 
    /* If the device is deleted, _del_cb will remove the device
       from the devices list. */
+again:
+   e->devices_modified = EINA_FALSE;
    cpy = eina_list_clone(e->devices);
    EINA_LIST_FREE(cpy, dev)
-     evas_device_del(dev);
+     {
+        evas_device_del(dev);
+        if (e->devices_modified)
+          {
+             eina_list_free(cpy);
+             goto again;
+          }
+     }
 
    /* Not all devices were deleted. The user probably will unref them later.
       Since Evas will be deleted, remove the del callback from them and
index f055bc0..3124f83 100644 (file)
@@ -977,6 +977,7 @@ struct _Evas_Public_Data
    Eina_Bool      render2 : 1;
    Eina_Bool      common_init : 1;
    Eina_Bool      inside_post_render : 1;
+   Eina_Bool      devices_modified : 1;
 };
 
 struct _Evas_Layer