From 6f5fc69b6785ec340f047053c581a1a7ac30a9b0 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Tue, 21 Jun 2011 19:34:19 +0200 Subject: [PATCH] compositor: Decrement buffers busy_count in post_release --- compositor/compositor.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/compositor/compositor.c b/compositor/compositor.c index 21fcfb4..f51973e 100644 --- a/compositor/compositor.c +++ b/compositor/compositor.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -619,12 +620,10 @@ wlsc_compositor_damage_all(struct wlsc_compositor *compositor) static inline void wlsc_buffer_post_release(struct wl_buffer *buffer) { - if (buffer->client == NULL) { - fprintf(stderr, "buffer.release warning: buffer.client: %p\n", - buffer->client); + if (buffer == NULL || --buffer->busy_count > 0) return; - } + assert(buffer->client != NULL); wl_client_post_event(buffer->client, &buffer->resource.object, WL_BUFFER_RELEASE); @@ -636,12 +635,8 @@ wlsc_output_finish_frame(struct wlsc_output *output, int msecs) struct wlsc_compositor *compositor = output->compositor; struct wlsc_animation *animation, *next; - if (output->scanout_buffer) { - if (--output->scanout_buffer->busy_count == 0) - wlsc_buffer_post_release(output->scanout_buffer); - - output->scanout_buffer = NULL; - } + wlsc_buffer_post_release(output->scanout_buffer); + output->scanout_buffer = NULL; output->finished = 1; @@ -942,10 +937,7 @@ surface_attach(struct wl_client *client, struct wlsc_surface *es = (struct wlsc_surface *) surface; buffer->busy_count++; - - if (es->buffer && es->buffer->busy_count > 0) - if (--es->buffer->busy_count == 0) - wlsc_buffer_post_release(es->buffer); + wlsc_buffer_post_release(es->buffer); es->buffer = buffer; wl_list_remove(&es->buffer_destroy_listener.link); -- 2.7.4