From 9e89188ebe46231680ee2712d09c0d0fa8f27ea6 Mon Sep 17 00:00:00 2001 From: Konkitoman Date: Thu, 19 Oct 2023 20:05:21 +0300 Subject: [PATCH] Fix trying to render not existent viewport resulting in 100% cpu usage --- crates/eframe/src/native/run.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/eframe/src/native/run.rs b/crates/eframe/src/native/run.rs index ab07f54b4..84f1ba2e2 100644 --- a/crates/eframe/src/native/run.rs +++ b/crates/eframe/src/native/run.rs @@ -285,6 +285,8 @@ fn run_and_return( if let Some(window) = winit_app.window(*window_id) { log::trace!("request_redraw"); window.read().request_redraw(); + } else { + windows_next_repaint_times.remove(window_id); } control_flow.set_poll(); } else { @@ -418,6 +420,8 @@ fn run_and_exit(event_loop: EventLoop, mut winit_app: impl WinitApp + if let Some(window) = winit_app.window(*window_id) { log::trace!("request_redraw"); window.read().request_redraw(); + } else { + windows_next_repaint_times.remove(window_id); } control_flow.set_poll(); } else {