gl-renderer: Prepare for buffer to outlive resource

Make sure we don't die if we're asked to flush the damage on a SHM
buffer which has subsequently been destroyed.

Signed-off-by: Daniel Stone <daniels@collabora.com>
dev
Daniel Stone 3 years ago
parent 7b3efabd88
commit d2a858e879
  1. 6
      libweston/renderer-gl/gl-renderer.c

@ -1849,6 +1849,12 @@ gl_renderer_flush_damage(struct weston_surface *surface,
pixman_region32_union(&gs->texture_damage, pixman_region32_union(&gs->texture_damage,
&gs->texture_damage, &surface->damage); &gs->texture_damage, &surface->damage);
/* This can happen if a SHM wl_buffer gets destroyed before we flush
* damage, because wayland-server just nukes the wl_shm_buffer from
* underneath us */
if (!buffer->shm_buffer)
return;
/* Avoid upload, if the texture won't be used this time. /* Avoid upload, if the texture won't be used this time.
* We still accumulate the damage in texture_damage, and * We still accumulate the damage in texture_damage, and
* hold the reference to the buffer, in case the surface * hold the reference to the buffer, in case the surface

Loading…
Cancel
Save