Fix double borrow in synchronous tests
This commit is contained in:
parent
e1cb993878
commit
1864d37d2e
2 changed files with 20 additions and 2 deletions
|
@ -68,9 +68,27 @@ impl AppCell {
|
|||
#[derive(Deref, DerefMut)]
|
||||
pub struct AppRef<'a>(Ref<'a, AppContext>);
|
||||
|
||||
impl<'a> Drop for AppRef<'a> {
|
||||
fn drop(&mut self) {
|
||||
if let Some(_) = option_env!("TRACK_THREAD_BORROWS") {
|
||||
let thread_id = std::thread::current().id();
|
||||
eprintln!("dropped borrow from {thread_id:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deref, DerefMut)]
|
||||
pub struct AppRefMut<'a>(RefMut<'a, AppContext>);
|
||||
|
||||
impl<'a> Drop for AppRefMut<'a> {
|
||||
fn drop(&mut self) {
|
||||
if let Some(_) = option_env!("TRACK_THREAD_BORROWS") {
|
||||
let thread_id = std::thread::current().id();
|
||||
eprintln!("dropped {thread_id:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct App(Rc<AppCell>);
|
||||
|
||||
/// Represents an application before it is fully launched. Once your app is
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue