anvil.glium_drawer: fix buffer release order

This commit is contained in:
Victor Berger 2019-04-10 15:24:17 +02:00 committed by Victor Berger
parent 9f9e6d4329
commit 0712bdefec
2 changed files with 17 additions and 4 deletions

View File

@ -11,7 +11,7 @@ edition = "2018"
members = [ "anvil" ] members = [ "anvil" ]
[dependencies] [dependencies]
wayland-server = { version = "0.23", optional = true } wayland-server = { version = "0.23.2", optional = true }
wayland-commons = { version = "0.23", optional = true } wayland-commons = { version = "0.23", optional = true }
wayland-sys = { version = "0.23", optional = true } wayland-sys = { version = "0.23", optional = true }
calloop = "0.4.2" calloop = "0.4.2"

View File

@ -302,13 +302,26 @@ impl<F: GLGraphicsBackend + 'static> GliumDrawer<F> {
if attributes.user_data.texture.is_none() { if attributes.user_data.texture.is_none() {
if let Some(buffer) = attributes.user_data.buffer.take() { if let Some(buffer) = attributes.user_data.buffer.take() {
if let Ok(m) = self.texture_from_buffer(buffer.clone()) { if let Ok(m) = self.texture_from_buffer(buffer.clone()) {
attributes.user_data.texture = Some(m); // release the buffer if it was an SHM buffer
} #[cfg(feature = "egl")]
// notify the client that we have finished reading the {
// buffer if m.images.is_none() {
buffer.release(); buffer.release();
} }
} }
#[cfg(not(feature = "egl"))]
{
buffer.release();
}
attributes.user_data.texture = Some(m);
} else {
// there was an error reading the buffer, release it, we
// already logged the error
buffer.release();
}
}
}
// Now, should we be drawn ? // Now, should we be drawn ?
if attributes.user_data.texture.is_some() { if attributes.user_data.texture.is_some() {
// if yes, also process the children // if yes, also process the children