[PATCH v2 weston 2/7] compositor: do not flush shm buffer on destroy

Pekka Paalanen ppaalanen at gmail.com
Tue Dec 4 05:58:11 PST 2012


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 at gmail.com>
---
 src/compositor.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 88a37f7..d80d929 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -187,9 +187,6 @@ surface_handle_buffer_destroy(struct wl_listener *listener, void *data)
 		container_of(listener, struct weston_surface, 
 			     buffer_destroy_listener);
 
-	if (es->buffer && wl_buffer_is_shm(es->buffer))
-		es->compositor->renderer->flush_damage(es);
-
 	es->buffer = NULL;
 }
 
-- 
1.7.8.6



More information about the wayland-devel mailing list