Merge pull request #144 from Smithay/pr/fix/anvil_buffer_leak
anvil: release old buffers on commit
This commit is contained in:
commit
f8f4f461c7
|
@ -143,13 +143,17 @@ fn surface_commit(surface: &wl_surface::WlSurface, token: CompositorToken<Roles>
|
|||
// new contents
|
||||
// TODO: handle hotspot coordinates
|
||||
let data = attributes.user_data.get_mut::<SurfaceData>().unwrap();
|
||||
data.buffer = Some(buffer);
|
||||
if let Some(old_buffer) = data.buffer.replace(buffer) {
|
||||
old_buffer.release();
|
||||
}
|
||||
data.texture = None;
|
||||
}
|
||||
Some(None) => {
|
||||
// erase the contents
|
||||
let data = attributes.user_data.get_mut::<SurfaceData>().unwrap();
|
||||
data.buffer = None;
|
||||
if let Some(old_buffer) = data.buffer.take() {
|
||||
old_buffer.release();
|
||||
}
|
||||
data.texture = None;
|
||||
}
|
||||
None => {}
|
||||
|
|
Loading…
Reference in New Issue