compositor: do not flush shm buffer on destroy

The protocol does not require us to flush_damage() on wl_buffer
destruction. In fact, by the time the server receives this request, the
client may have already clobbered the buffer's storage, so we could be
reading undefined data. Instead, just forget about the buffer. The
protocol already says, that a client must not destroy a buffer that is
being read by the server, or the window contents become undefined.

The practical reason for this change is that the following commit can
consolidate wl_buffer destruction listener handlers.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
dev
Pekka Paalanen 12 years ago committed by Kristian Høgsberg
parent a6421c4ea8
commit aecd3ec54f
  1. 3
      src/compositor.c

@ -187,9 +187,6 @@ surface_handle_buffer_destroy(struct wl_listener *listener, void *data)
container_of(listener, struct weston_surface, container_of(listener, struct weston_surface,
buffer_destroy_listener); buffer_destroy_listener);
if (es->buffer && wl_buffer_is_shm(es->buffer))
es->compositor->renderer->flush_damage(es);
es->buffer = NULL; es->buffer = NULL;
} }

Loading…
Cancel
Save