1
0
Fork 0
forked from wry/wry

wl_surface: handle buffer release automatically

This commit is contained in:
Julian Orth 2026-02-28 02:19:45 +01:00
parent 6bdd1ff6e7
commit 8f576f498e
5 changed files with 51 additions and 34 deletions

View file

@ -48,6 +48,19 @@ pub struct DmabufBufferParams {
tex_impossible: bool,
}
pub struct AttachedBuffer {
pub send_release: bool,
pub buf: Rc<WlBuffer>,
}
impl Drop for AttachedBuffer {
fn drop(&mut self) {
if self.send_release && !self.buf.destroyed() {
self.buf.send_release();
}
}
}
pub struct WlBuffer {
pub id: WlBufferId,
destroyed: Cell<bool>,
@ -507,7 +520,7 @@ impl WlBuffer {
Ok(())
}
pub fn send_release(&self) {
fn send_release(&self) {
self.client.event(Release { self_id: self.id })
}
}