If wl_shm_buffer_get_data() is called on a shm pool that has an external
reference and a pending resize, then the buffer may be outside the pool's
current mapping.

Log a warning if this happens.

Signed-off-by: Derek Foreman <[email protected]>
---
 src/wayland-shm.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/wayland-shm.c b/src/wayland-shm.c
index 6351259..7c67575 100644
--- a/src/wayland-shm.c
+++ b/src/wayland-shm.c
@@ -387,6 +387,11 @@ wl_shm_buffer_get_data(struct wl_shm_buffer *buffer)
        if (!buffer->pool)
                return NULL;
 
+       if (buffer->pool->external_refcount &&
+           (buffer->pool->size != buffer->pool->new_size))
+               wl_log("Buffer address requested when its parent pool "
+                      "has an external reference and a deferred resize "
+                      "pending.\n");
        return buffer->pool->data + buffer->offset;
 }
 
-- 
2.7.0

_______________________________________________
wayland-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to