{
tdm_private_display *private_display;
tdm_func_capture *func_capture;
- tdm_buffer_info *b = NULL, *bb = NULL;
+ tdm_capture_private_buffer *b = NULL, *bb = NULL;
+ struct list_head clone_list;
TDM_RETURN_IF_FAIL(TDM_MUTEX_IS_LOCKED());
TDM_WRN("capture(%p) not finished:", private_capture);
_tdm_capture_print_list(&private_capture->pending_buffer_list);
+ LIST_INITHEAD(&clone_list);
LIST_FOR_EACH_ENTRY_SAFE(b, bb, &private_capture->pending_buffer_list, link) {
LIST_DEL(&b->link);
- _pthread_mutex_unlock(&private_display->lock);
+ LIST_ADDTAIL(&b->link, &clone_list);
+ }
+
+ _pthread_mutex_unlock(&private_display->lock);
+ LIST_FOR_EACH_ENTRY_SAFE(b, bb, &clone_list, link) {
+ LIST_DEL(&b->link);
tdm_buffer_unref_backend(b->buffer);
- _pthread_mutex_lock(&private_display->lock);
free(b);
}
+ _pthread_mutex_lock(&private_display->lock);
}
if (!LIST_IS_EMPTY(&private_capture->buffer_list)) {
TDM_WRN("capture(%p) not finished:", private_capture);
_tdm_capture_print_list(&private_capture->buffer_list);
+ LIST_INITHEAD(&clone_list);
LIST_FOR_EACH_ENTRY_SAFE(b, bb, &private_capture->buffer_list, link) {
LIST_DEL(&b->link);
- _pthread_mutex_unlock(&private_display->lock);
+ LIST_ADDTAIL(&b->link, &clone_list);
+ }
+
+ _pthread_mutex_unlock(&private_display->lock);
+ LIST_FOR_EACH_ENTRY_SAFE(b, bb, &clone_list, link) {
+ LIST_DEL(&b->link);
tdm_buffer_unref_backend(b->buffer);
- _pthread_mutex_lock(&private_display->lock);
free(b);
}
+ _pthread_mutex_lock(&private_display->lock);
}
private_capture->stamp = 0;
}
}
- capture_buffer = calloc(1, sizeof *capture_buffer);
+ capture_buffer = calloc(1, sizeof * capture_buffer);
if (!capture_buffer) {
_pthread_mutex_unlock(&private_display->lock);
TDM_ERR("alloc failed");