From aee64eed70a0b41421538687806ae8f316664296 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 16 Nov 2022 12:50:45 +0100 Subject: [PATCH] Remove AppRunnerContainer::events --- crates/eframe/src/web/backend.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/eframe/src/web/backend.rs b/crates/eframe/src/web/backend.rs index c4fcaf20..6cf8ee72 100644 --- a/crates/eframe/src/web/backend.rs +++ b/crates/eframe/src/web/backend.rs @@ -471,7 +471,6 @@ pub struct AppRunnerContainer { /// Set to `true` if there is a panic. /// Used to ignore callbacks after a panic. pub panicked: Arc, - pub events: Vec, } impl AppRunnerContainer { @@ -511,7 +510,10 @@ impl AppRunnerContainer { closure, }; - self.events.push(EventToUnsubscribe::TargetEvent(handle)); + self.runner + .lock() + .events_to_unsubscribe + .push(EventToUnsubscribe::TargetEvent(handle)); Ok(()) } @@ -542,7 +544,6 @@ fn start_runner(app_runner: AppRunner) -> Result { let mut runner_container = AppRunnerContainer { runner: Arc::new(Mutex::new(app_runner)), panicked: Arc::new(AtomicBool::new(false)), - events: Vec::with_capacity(20), }; super::events::install_canvas_events(&mut runner_container)?; @@ -554,8 +555,6 @@ fn start_runner(app_runner: AppRunner) -> Result { // Disable all event handlers on panic let previous_hook = std::panic::take_hook(); - runner_container.runner.lock().events_to_unsubscribe = runner_container.events; - std::panic::set_hook(Box::new(move |panic_info| { tracing::info!("egui disabled all event handlers due to panic"); runner_container.panicked.store(true, SeqCst);