From 426e0e3d4f577dfcec082e8ccd333033016ba383 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 28 Feb 2022 22:17:20 -0800 Subject: [PATCH] Flush effects when dropping a TestAppContext This way, at the end of a test, dropped entities will be removed, and will drop the handles that they hold. --- crates/gpui/src/app.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index ff2baac8d9b4e0032cca63175730548acc25089f..1c9ab05cdde2a5e374fb59e933de8914e7e7eece 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -565,6 +565,12 @@ impl TestAppContext { } } +impl Drop for TestAppContext { + fn drop(&mut self) { + self.cx.borrow_mut().flush_effects(); + } +} + impl AsyncAppContext { pub fn spawn(&self, f: F) -> Task where