1
0
Fork 0
forked from wry/wry

it: track whether objects have been deleted

This commit is contained in:
Julian Orth 2022-05-03 15:54:32 +02:00
parent cdab4d4cad
commit 6af9d909b8
22 changed files with 167 additions and 45 deletions

View file

@ -2,7 +2,9 @@ use {
crate::{
ifs::wl_surface::xdg_surface::xdg_toplevel::XdgToplevel,
it::{
test_error::TestError, test_object::TestObject, test_transport::TestTransport,
test_error::TestError,
test_object::{Deleted, TestObject},
test_transport::TestTransport,
testrun::ParseFull,
},
utils::buffd::MsgParser,
@ -20,6 +22,7 @@ pub struct TestXdgToplevel {
pub tran: Rc<TestTransport>,
pub destroyed: Cell<bool>,
pub server: Rc<XdgToplevel>,
pub deleted: Deleted,
pub width: Cell<i32>,
pub height: Cell<i32>,
@ -29,10 +32,12 @@ pub struct TestXdgToplevel {
}
impl TestXdgToplevel {
pub fn destroy(&self) {
pub fn destroy(&self) -> Result<(), TestError> {
if !self.destroyed.replace(true) {
self.deleted.check()?;
self.tran.send(Destroy { self_id: self.id });
}
Ok(())
}
fn handle_configure(&self, parser: MsgParser<'_, '_>) -> Result<(), TestError> {
@ -57,7 +62,7 @@ impl TestXdgToplevel {
impl Drop for TestXdgToplevel {
fn drop(&mut self) {
self.destroy();
let _ = self.destroy();
}
}