1
0
Fork 0
forked from wry/wry

it: simplify tracking of deleted objects

This commit is contained in:
Julian Orth 2022-05-03 17:31:44 +02:00
parent ae34a65efe
commit fd027d9a5a
17 changed files with 57 additions and 154 deletions

View file

@ -1,12 +1,8 @@
use {
crate::{
it::{
test_error::TestError,
test_ifs::test_shm_pool::TestShmPool,
test_mem::TestMem,
test_object::{Deleted, TestObject},
test_transport::TestTransport,
testrun::ParseFull,
test_error::TestError, test_ifs::test_shm_pool::TestShmPool, test_mem::TestMem,
test_object::TestObject, test_transport::TestTransport, testrun::ParseFull,
},
utils::{buffd::MsgParser, clonecell::CloneCell, copyhashmap::CopyHashMap},
wire::{wl_shm::*, WlShmId},
@ -19,7 +15,6 @@ pub struct TestShm {
pub tran: Rc<TestTransport>,
pub formats: CopyHashMap<u32, ()>,
pub formats_awaited: Cell<bool>,
pub deleted: Deleted,
}
impl TestShm {
@ -37,15 +32,13 @@ impl TestShm {
tran: self.tran.clone(),
mem: CloneCell::new(mem.clone()),
destroyed: Cell::new(false),
deleted: Default::default(),
});
self.deleted.check()?;
self.tran.send(CreatePool {
self_id: self.id,
id: pool.id,
fd: mem.fd.clone(),
size: size as _,
});
})?;
self.tran.add_obj(pool.clone())?;
Ok(pool)
}