From 19f807b4e9f528aa4367818d6c80ffecfea54be7 Mon Sep 17 00:00:00 2001 From: Konkitoman Date: Tue, 25 Jul 2023 09:57:54 +0300 Subject: [PATCH] Fix 100% cpu usage because a non existen window is tryng to draw Fix a small memory leak --- crates/eframe/src/native/run.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/eframe/src/native/run.rs b/crates/eframe/src/native/run.rs index f443eae14..d7d8eac35 100644 --- a/crates/eframe/src/native/run.rs +++ b/crates/eframe/src/native/run.rs @@ -250,8 +250,11 @@ fn run_and_return( if let Some(window) = winit_app.window(*window_id) { window.request_redraw(); windows_next_repaint_times.remove(window_id); + control_flow.set_poll(); + } else { + windows_next_repaint_times.remove(window_id); + control_flow.set_wait(); } - control_flow.set_poll(); } else { next_repaint_time = Some( next_repaint_time