efl_ui_table: remove inlist items in EINA_INLIST_FREE macro
authorYeongjong Lee <yj34.lee@samsung.com>
Fri, 23 Aug 2019 17:22:33 +0000 (13:22 -0400)
committerHosang Kim <hosang12.kim@samsung.com>
Wed, 28 Aug 2019 04:30:52 +0000 (13:30 +0900)
Summary:
Check the EINA_INLIST_FREE document
```
in eina_inlist.h

NOTE: it is the duty of the body loop to properly remove the item from the
inlist and free it. This function will turn into a infinite loop if you
don't remove all items from the list.
```

This will avoid infinite loop when Efl.Ui.Table is invalidated.

ref T8145

Test Plan: See the test file in T8145

Reviewers: brunobelo, Jaehyun_Cho, zmike

Reviewed By: zmike

Subscribers: zmike, cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8145

Differential Revision: https://phab.enlightenment.org/D9699

src/lib/elementary/efl_ui_table.c

index 24fa927..2e9a63a 100644 (file)
@@ -244,6 +244,10 @@ _efl_ui_table_efl_object_invalidate(Eo *obj, Efl_Ui_Table_Data *pd)
    EINA_INLIST_FREE(EINA_INLIST_GET(pd->items), gi)
      {
         efl_event_callback_array_del(gi->object, efl_ui_table_callbacks(), obj);
+
+        pd->items = (Table_Item *)
+            eina_inlist_remove(EINA_INLIST_GET(pd->items), EINA_INLIST_GET(gi));
+        free(gi);
      }
 }