mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
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.
This commit is contained in:
parent
e8e9cd5595
commit
5b6a2b0eaf
1 changed files with 4 additions and 0 deletions
4
shm.c
4
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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue