in src/platform_impl/linux/x11/event_processor.rs [53:75]
fn with_window<F, Ret>(&self, window_id: ffi::Window, callback: F) -> Option<Ret>
where
F: Fn(&Arc<UnownedWindow>) -> Ret,
{
let mut deleted = false;
let window_id = WindowId(window_id);
let wt = get_xtarget(&self.target);
let result = wt
.windows
.borrow()
.get(&window_id)
.and_then(|window| {
let arc = window.upgrade();
deleted = arc.is_none();
arc
})
.map(|window| callback(&window));
if deleted {
// Garbage collection
wt.windows.borrow_mut().remove(&window_id);
}
result
}