mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
buffer: add a release event
Consumers call wlr_buffer_lock. Once all consumers are done with the buffer, only the producer should have a reference to the buffer. In this case, we can release the buffer (and let the producer re-use it).
This commit is contained in:
parent
1674ca725c
commit
6595db6409
6 changed files with 98 additions and 37 deletions
|
|
@ -114,7 +114,7 @@ static void destroy_wl_buffer(struct wlr_wl_buffer *buffer) {
|
|||
return;
|
||||
}
|
||||
wl_buffer_destroy(buffer->wl_buffer);
|
||||
wlr_buffer_unref(buffer->buffer);
|
||||
wlr_buffer_unlock(buffer->buffer);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ static struct wlr_wl_buffer *create_wl_buffer(struct wlr_wl_backend *wl,
|
|||
return NULL;
|
||||
}
|
||||
buffer->wl_buffer = wl_buffer;
|
||||
buffer->buffer = wlr_buffer_ref(wlr_buffer);
|
||||
buffer->buffer = wlr_buffer_lock(wlr_buffer);
|
||||
|
||||
wl_buffer_add_listener(wl_buffer, &buffer_listener, buffer);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue