From 7f713ccb038a36c8fc8043693ce4f40e9f8f1d17 Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Wed, 20 Apr 2022 18:10:04 +0900 Subject: [PATCH] examples/tinyds: Remove redundant referencing ds_buffer ds_buffer is supposed to be referenced by ds_output while using it, so tinyds doesn't have any reasons to reference a ds_buffer for the output. Change-Id: I7f4aacd9263f4b70c57d269f118605b743d5b847 --- src/examples/tinyds.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/examples/tinyds.c b/src/examples/tinyds.c index 61366fb..ed3ed01 100644 --- a/src/examples/tinyds.c +++ b/src/examples/tinyds.c @@ -54,7 +54,6 @@ struct tinyds_output struct ds_output *ds_output; struct ds_allocator *allocator; struct ds_swapchain *swapchain; - struct ds_buffer *front_buffer; struct wl_listener output_destroy; struct wl_listener output_frame; @@ -325,7 +324,6 @@ init_output(struct tinyds_output *output, struct tinyds_server *server, output->server = server; output->width = width; output->height = height; - output->front_buffer = NULL; output->drawable = true; output->damaged = true; @@ -365,8 +363,6 @@ static void fini_output(struct tinyds_output *output) { wl_list_remove(&output->link); - if (output->front_buffer) - ds_buffer_unlock(output->front_buffer); if (output->ds_output) ds_output_destroy(output->ds_output); ds_swapchain_destroy(output->swapchain); @@ -411,10 +407,8 @@ draw_output(struct tinyds_output *output) output_image = pixman_image_from_buffer(output_buffer, DS_BUFFER_DATA_PTR_ACCESS_WRITE); - if (!output_image) { - ds_buffer_unlock(output_buffer); - return; - } + if (!output_image) + goto out; pixman_image_fill_color(output_image, 80, 80, 80); @@ -428,12 +422,11 @@ draw_output(struct tinyds_output *output) ds_output_attach_buffer(output->ds_output, output_buffer); ds_output_commit(output->ds_output); - if (output->front_buffer) - ds_buffer_unlock(output->front_buffer); - output->front_buffer = output_buffer; - output->drawable = false; output->damaged = false; + +out: + ds_buffer_unlock(output_buffer); } static void -- 2.7.4