pixman-renderer: Unref the pixman image when wl_shm_buffer is gone

Even if the weston_buffer_reference is still alive in situations like
when we have closing animations, the underyling buffer (wl_shm_buffer)
is no longer available. Call the appropriate destroy handler to
invalidate the pixman image and avoid touch the shm_buffer.

Fixes: #613

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
dev
Marius Vlad 2 years ago
parent b6fc6b2a8d
commit 69a59359fa
  1. 14
      libweston/pixman-renderer.c

@ -36,6 +36,7 @@
#include "color.h" #include "color.h"
#include "pixel-formats.h" #include "pixel-formats.h"
#include "shared/helpers.h" #include "shared/helpers.h"
#include "shared/signal.h"
#include <linux/input.h> #include <linux/input.h>
@ -489,6 +490,19 @@ draw_paint_node(struct weston_paint_node *pnode,
if (!ps->image) if (!ps->image)
return; return;
/* if we still have a reference, but the underlying buffer is no longer
* available signal that we should unref image_t as well. This happens
* when using close animations, with the reference surviving the
* animation while the underlying buffer went away as the client was
* terminated. This is a particular use-case and should probably be
* refactored to provide some analogue with the GL-renderer (as in, to
* still maintain the buffer and let the compositor dispose of it). */
if (ps->buffer_ref.buffer && !ps->buffer_ref.buffer->shm_buffer) {
pixman_image_unref(ps->image);
ps->image = NULL;
return;
}
pixman_region32_init(&repaint); pixman_region32_init(&repaint);
pixman_region32_intersect(&repaint, pixman_region32_intersect(&repaint,
&pnode->view->transform.boundingbox, damage); &pnode->view->transform.boundingbox, damage);

Loading…
Cancel
Save