From 187ec42d96e4af9f1de787885e30d6f63d9a8998 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Thu, 24 Nov 2016 16:43:33 +0900 Subject: [PATCH] use LIST_FOR_EACH_ENTRY_SAFE at _notify_emit 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 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/tbm_surface_queue.c b/src/tbm_surface_queue.c index ea5b09e..314bbe0 100644 --- a/src/tbm_surface_queue.c +++ b/src/tbm_surface_queue.c @@ -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); } -- 2.7.4