aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-07-18 14:44:49 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-07-18 14:44:49 +0000
commit5b6a2b0eaff1ffef84d728a6c76c044c7f01a1d8 (patch)
tree9feaecf92c54bb1d810cd2c3d1b0409b64f1c6e9
parentterm: erase_scrollback(): destroy sixels that touch the scrollback (diff)
shm: get_many(): allow “NULL” buffers - buffers where width or height is 0
When a zero-sized buffer is requested, simply return a NULL buffer, instead of crashing with a Wayland protocol error. This makes it easier to request many buffers, where some may be zero-sized, without having to pack the width/height and bufs arrays.
-rw-r--r--shm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/shm.c b/shm.c
index 0e55011d..60e45d4d 100644
--- a/shm.c
+++ b/shm.c
@@ -436,6 +436,10 @@ get_new_buffers(struct buffer_chain *chain, size_t count,
};
for (size_t i = 0; i < count; i++) {
+ if (sizes[i] == 0) {
+ bufs[i] = NULL;
+ continue;
+ }
/* Push to list of available buffers, but marked as 'busy' */
struct buffer_private *buf = xmalloc(sizeof(*buf));