use LIST_FOR_EACH_ENTRY_SAFE at _notify_emit 22/99822/1
authorSooChan Lim <sc1.lim@samsung.com>
Thu, 24 Nov 2016 07:43:33 +0000 (16:43 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Thu, 24 Nov 2016 07:45:21 +0000 (16:45 +0900)
The item->cb is the outside function of the libtbm.
The tbm user may/can remove the item of the list,
so we have to use the LIST_FOR_EACH_ENTRY_SAFE.

Change-Id: Ib8ccbe0e1145f410001798a54535ee92d8dcc209

src/tbm_surface_queue.c

index ea5b09e..314bbe0 100644 (file)
@@ -414,9 +414,14 @@ static void
 _notify_emit(tbm_surface_queue_h surface_queue,
             struct list_head *list)
 {
-       queue_notify *item = NULL;
-
-       LIST_FOR_EACH_ENTRY(item, list, link)
+       queue_notify *item = NULL, *tmp;;
+
+       /*
+               The item->cb is the outside function of the libtbm.
+               The tbm user may/can remove the item of the list,
+               so we have to use the LIST_FOR_EACH_ENTRY_SAFE.
+       */
+       LIST_FOR_EACH_ENTRY_SAFE(item, tmp, list, link)
                item->cb(surface_queue, item->data);
 }