anvil.glium_drawer: fix buffer release order
This commit is contained in:
parent
9f9e6d4329
commit
0712bdefec
|
@ -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"
|
||||||
|
|
|
@ -302,11 +302,24 @@ 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()) {
|
||||||
|
// release the buffer if it was an SHM buffer
|
||||||
|
#[cfg(feature = "egl")]
|
||||||
|
{
|
||||||
|
if m.images.is_none() {
|
||||||
|
buffer.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(not(feature = "egl"))]
|
||||||
|
{
|
||||||
|
buffer.release();
|
||||||
|
}
|
||||||
|
|
||||||
attributes.user_data.texture = Some(m);
|
attributes.user_data.texture = Some(m);
|
||||||
|
} else {
|
||||||
|
// there was an error reading the buffer, release it, we
|
||||||
|
// already logged the error
|
||||||
|
buffer.release();
|
||||||
}
|
}
|
||||||
// notify the client that we have finished reading the
|
|
||||||
// buffer
|
|
||||||
buffer.release();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Now, should we be drawn ?
|
// Now, should we be drawn ?
|
||||||
|
|
Loading…
Reference in New Issue