Add calls to wl_shm_buffer_begin/end_access
This wraps all accesses to an SHM buffer between wl_shm_buffer_begin
and end so that wayland-shm can install a handler for SIGBUS and catch
attempts to pass the compositor a buffer that is too small.
diff --git a/src/screenshooter.c b/src/screenshooter.c
index 645114d..0c657bc 100644
--- a/src/screenshooter.c
+++ b/src/screenshooter.c
@@ -144,6 +144,8 @@
d = wl_shm_buffer_get_data(l->buffer->shm_buffer);
s = pixels + stride * (l->buffer->height - 1);
+ wl_shm_buffer_begin_access(l->buffer->shm_buffer);
+
switch (compositor->read_format) {
case PIXMAN_a8r8g8b8:
case PIXMAN_x8r8g8b8:
@@ -163,6 +165,8 @@
break;
}
+ wl_shm_buffer_end_access(l->buffer->shm_buffer);
+
screenshooter_send_done(l->resource);
free(pixels);
free(l);