From 6aac53b7e9506ce76a53e2f5e8852f09b90b4c5d Mon Sep 17 00:00:00 2001 From: Boram Park Date: Mon, 7 Aug 2017 16:57:16 +0900 Subject: [PATCH] remove buffers from commit_buffer_list when commit failed. When pp, commit is the sync operation, cb_done() will be called at the line of commit(). In this case, buffers will be freed in cb_done() before LIST_FOR_EACH_ENTRY_SAFE(b, bb, &commit_buffer_list, commit_link) line done. So commit_link should be deleted when freed. When commit() successed, commit_link will be deleted twice. So we need to use LIST_DELINIT instead of LIST_DEL Change-Id: I6a09878e1eae49d31eb3f3626e005a3ae10841d8 --- src/tdm_capture.c | 3 ++- src/tdm_pp.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tdm_capture.c b/src/tdm_capture.c index 2bd1986..6be39eb 100644 --- a/src/tdm_capture.c +++ b/src/tdm_capture.c @@ -149,6 +149,7 @@ tdm_capture_cb_done(tdm_capture *capture_backend, tbm_surface_h buffer, if ((capture_buffer = _tdm_capture_find_tbm_buffer(&private_capture->buffer_list, buffer))) { LIST_DEL(&capture_buffer->link); + LIST_DELINIT(&capture_buffer->commit_link); _pthread_mutex_unlock(&private_display->lock); if (private_capture->done_func) @@ -561,7 +562,7 @@ tdm_capture_commit(tdm_capture *capture) TDM_WARNING_IF_FAIL(ret == TDM_ERROR_NONE); LIST_FOR_EACH_ENTRY_SAFE(b, bb, &commit_buffer_list, commit_link) { - LIST_DEL(&b->commit_link); + LIST_DELINIT(&b->commit_link); if (!_tdm_capture_find_buffer(&private_capture->buffer_list, b)) continue; diff --git a/src/tdm_pp.c b/src/tdm_pp.c index 52ef19b..ab95105 100644 --- a/src/tdm_pp.c +++ b/src/tdm_pp.c @@ -150,6 +150,7 @@ tdm_pp_cb_done(tdm_pp *pp_backend, tbm_surface_h src, tbm_surface_h dst, if ((pp_buffer = _tdm_pp_find_tbm_buffers(&private_pp->buffer_list, src, dst))) { LIST_DEL(&pp_buffer->link); + LIST_DELINIT(&pp_buffer->commit_link); _pthread_mutex_unlock(&private_display->lock); if (private_pp->done_func) @@ -477,7 +478,7 @@ tdm_pp_commit(tdm_pp *pp) TDM_WARNING_IF_FAIL(ret == TDM_ERROR_NONE); LIST_FOR_EACH_ENTRY_SAFE(b, bb, &commit_buffer_list, commit_link) { - LIST_DEL(&b->commit_link); + LIST_DELINIT(&b->commit_link); if (!_tdm_pp_find_buffer(&private_pp->buffer_list, b)) continue; -- 2.7.4