_twe_del_source_fini(twe_del_source *source);
static void
_twe_thread_wl_surface_acquire_and_commit(twe_wl_surf_source *surf_source);
+static void
+__cb_buffer_remove_from_list(void *data);
static gpointer
_twe_thread_loop(gpointer data)
*/
if (surf_source->committed_buffers) {
TPL_OBJECT_LOCK(&surf_source->obj);
- while (!__tpl_list_is_empty(surf_source->committed_buffers)) {
- tbm_surface_h tbm_surface =
- __tpl_list_pop_front(surf_source->committed_buffers, NULL);
- tbm_surface_internal_unref(tbm_surface);
- }
+ __tpl_list_fini(surf_source->committed_buffers,
+ (tpl_free_func_t)__cb_buffer_remove_from_list);
TPL_OBJECT_UNLOCK(&surf_source->obj);
}
}
static void
+__cb_buffer_remove_from_list(void *data)
+{
+ tbm_surface_h tbm_surface = (tbm_surface_h)data;
+
+ if (tbm_surface && tbm_surface_internal_is_valid(tbm_surface))
+ tbm_surface_internal_unref(tbm_surface);
+}
+
+static void
_twe_thread_wl_surf_source_destroy(void *source)
{
twe_wl_surf_source *surf_source = (twe_wl_surf_source *)source;
TPL_OBJECT_LOCK(&disp_source->obj);
- while (!__tpl_list_is_empty(surf_source->in_use_buffers)) {
- tbm_surface_h tbm_surface = (tbm_surface_h)__tpl_list_pop_front(
- surf_source->in_use_buffers,
- NULL);
- tbm_surface_internal_unref(tbm_surface);
+ if (surf_source->in_use_buffers) {
+ __tpl_list_free(surf_source->in_use_buffers,
+ (tpl_free_func_t)__cb_buffer_remove_from_list);
+ surf_source->in_use_buffers = NULL;
}
- __tpl_list_free(surf_source->in_use_buffers, NULL);
-
- surf_source->in_use_buffers = NULL;
-
if (surf_source->committed_buffers) {
- while (!__tpl_list_is_empty(surf_source->committed_buffers)) {
- tbm_surface_h tbm_surface =
- (tbm_surface_h)__tpl_list_pop_front(
- surf_source->committed_buffers,
- NULL);
- tbm_surface_internal_unref(tbm_surface);
- }
-
- __tpl_list_free(surf_source->committed_buffers, NULL);
+ __tpl_list_free(surf_source->committed_buffers,
+ (tpl_free_func_t)__cb_buffer_remove_from_list);
surf_source->committed_buffers = NULL;
}