diff options
| author | Sebastian Wick <sebastian.wick@redhat.com> | 2025-03-21 19:42:52 +0100 |
|---|---|---|
| committer | Sebastian Wick <sebastian.wick@redhat.com> | 2025-05-20 21:50:22 +0200 |
| commit | 9367c4da76c9fd118d505e40ad5d554e8fe249a1 (patch) | |
| tree | 6e70e13380a1117d401c9e04fefb9dfdab8c7c16 /src/wayland-server-core.h | |
| parent | shm: Remove refcount check which cannot be triggered (diff) | |
| download | wayland-9367c4da76c9fd118d505e40ad5d554e8fe249a1.tar wayland-9367c4da76c9fd118d505e40ad5d554e8fe249a1.tar.gz wayland-9367c4da76c9fd118d505e40ad5d554e8fe249a1.tar.bz2 wayland-9367c4da76c9fd118d505e40ad5d554e8fe249a1.tar.lz wayland-9367c4da76c9fd118d505e40ad5d554e8fe249a1.tar.xz wayland-9367c4da76c9fd118d505e40ad5d554e8fe249a1.tar.zst wayland-9367c4da76c9fd118d505e40ad5d554e8fe249a1.zip | |
shm: Add wl_shm_buffer ref and unref functions
Shared memory buffers are currently tied to the lifetime of their
underlying wl_buffer resource. This becomes problematic when the client
destroys the resource after committing new state which references the
wl_buffer because a compositor might have to defer applying the commit.
This commit adds methods to keep the wl_shm_buffer alive longer than the
underlying resource. This implicitly also keeps the buffer pool alive
and because the wl_shm_buffer uses offsets into the pool, it even works
when the underlying storage gets remapped somewhere else, which can
happen when the client resizes the pool.
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
Diffstat (limited to 'src/wayland-server-core.h')
| -rw-r--r-- | src/wayland-server-core.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wayland-server-core.h b/src/wayland-server-core.h index 15c3b76..005a324 100644 --- a/src/wayland-server-core.h +++ b/src/wayland-server-core.h @@ -666,6 +666,12 @@ wl_shm_buffer_get_width(const struct wl_shm_buffer *buffer); int32_t wl_shm_buffer_get_height(const struct wl_shm_buffer *buffer); +struct wl_shm_buffer * +wl_shm_buffer_ref(struct wl_shm_buffer *buffer); + +void +wl_shm_buffer_unref(struct wl_shm_buffer *buffer); + struct wl_shm_pool * wl_shm_buffer_ref_pool(struct wl_shm_buffer *buffer); |
