From 03bc2362a7628c0ebe072f091770ae1378361f3b Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Tue, 21 Mar 2023 14:42:57 +0100 Subject: [PATCH] Fix requiring requiring focus for shutdown via ctrl+c when starting viewer from command line --- crates/rerun/src/run.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/rerun/src/run.rs b/crates/rerun/src/run.rs index 1994e424e139..060d5b901710 100644 --- a/crates/rerun/src/run.rs +++ b/crates/rerun/src/run.rs @@ -355,6 +355,14 @@ async fn run_impl( } else { #[cfg(feature = "native_viewer")] return re_viewer::run_native_app(Box::new(move |cc, re_ui| { + // We need to wake up the ui thread in order to process shutdown signals. + let ctx = cc.egui_ctx.clone(); + let mut shutdown_repaint = shutdown_rx.resubscribe(); + tokio::spawn(async move { + shutdown_repaint.recv().await.unwrap(); + ctx.request_repaint(); + }); + let rx = re_viewer::wake_up_ui_thread_on_each_msg(rx, cc.egui_ctx.clone()); let mut app = re_viewer::App::from_receiver( _build_info,