remove buffers from commit_buffer_list when commit failed. 76/142776/1
authorBoram Park <boram1288.park@samsung.com>
Mon, 7 Aug 2017 07:57:16 +0000 (16:57 +0900)
committerBoram Park <boram1288.park@samsung.com>
Mon, 7 Aug 2017 08:00:53 +0000 (17:00 +0900)
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
src/tdm_pp.c

index 2bd1986..6be39eb 100644 (file)
@@ -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;
index 52ef19b..ab95105 100644 (file)
@@ -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;