weston_buffer: Prepare for buffer to outlive resource

We currently allow a weston_buffer to outlive the underlying wl_buffer
iff the renderer/backend has cached it. Currently the 'is this buffer
valid?' test relies on looking for the validity of the weston_buffer
itself; shift these tests to looking at the validity of the underlying
resource.

Signed-off-by: Daniel Stone <daniels@collabora.com>
dev
Daniel Stone 3 years ago
parent e9c792ed64
commit 7b3efabd88
  1. 6
      libweston/compositor.c
  2. 1
      libweston/data-device.c

@ -1983,7 +1983,11 @@ weston_view_is_opaque(struct weston_view *ev, pixman_region32_t *region)
WL_EXPORT bool
weston_view_has_valid_buffer(struct weston_view *ev)
{
return ev->surface->buffer_ref.buffer != NULL;
if (!ev->surface->buffer_ref.buffer)
return false;
if (!ev->surface->buffer_ref.buffer->resource)
return false;
return true;
}
/** Check if the view matches the entire output

@ -420,6 +420,7 @@ drag_surface_configure(struct weston_drag *drag,
assert((pointer != NULL && touch == NULL) ||
(pointer == NULL && touch != NULL));
/* XXX: Why are we checking for a valid buffer here too ... ? */
if (!weston_surface_is_mapped(es) && es->buffer_ref.buffer) {
if (pointer && pointer->sprite &&
weston_view_is_mapped(pointer->sprite))

Loading…
Cancel
Save