From fbac451724f7e1b8ce6b6e0505cc33ccd41c5158 Mon Sep 17 00:00:00 2001 From: Arcady Goldmints-Orlov Date: Thu, 4 Oct 2012 14:22:13 -0700 Subject: [PATCH] Fix alphamap interactions with wfb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Set a destructor function on pixman images and call fbFinishAccess() from there, rather than directly from free_pixman_pict(). This ensures that fbFinishAccess() gets called even if pixman still has a reference to the image after free_pixman_pict(), as is the case for alphamaps. [ajax: Squash an unused variable warning in the non-wfb build] Reviewed-by: Aaron Plattner Signed-off-by: Arcady Goldmints-Orlov Reviewed-by: Søren Sandmann --- fb/fbpict.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/fb/fbpict.c b/fb/fbpict.c index 021f17883..7ea0b668f 100644 --- a/fb/fbpict.c +++ b/fb/fbpict.c @@ -345,6 +345,11 @@ static pixman_image_t *image_from_pict_internal(PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map); +static void image_destroy(pixman_image_t *image, void *data) +{ + fbFinishAccess((DrawablePtr)data); +} + static void set_image_properties(pixman_image_t * image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map) @@ -429,6 +434,10 @@ set_image_properties(pixman_image_t * image, PicturePtr pict, Bool has_clip, break; } + if (pict->pDrawable) + pixman_image_set_destroy_function(image, &image_destroy, + pict->pDrawable); + pixman_image_set_filter(image, filter, (pixman_fixed_t *) pict->filter_params, pict->filter_nparams); @@ -481,8 +490,8 @@ image_from_pict(PicturePtr pict, Bool has_clip, int *xoff, int *yoff) void free_pixman_pict(PicturePtr pict, pixman_image_t * image) { - if (image && pixman_image_unref(image) && pict->pDrawable) - fbFinishAccess(pict->pDrawable); + if (image) + pixman_image_unref(image); } Bool