From 9772b7ac33d9679db30bcc7305de717d52f09da2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=B0=8F=E7=99=BD?= <364772080@qq.com> Date: Thu, 9 May 2024 11:15:32 +0800 Subject: [PATCH] windows: Fix `Zed` freezing when resuming from sleep (#11589) It seems that on the first frame after the system resumes from sleep, `dcomp_vsync_fn` mistakenly detects the `timer_stop_event` triggering and exits the loop. Release Notes: - N/A --- crates/gpui/src/platform/windows/platform.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/gpui/src/platform/windows/platform.rs b/crates/gpui/src/platform/windows/platform.rs index efd3695843..a38e0d18b4 100644 --- a/crates/gpui/src/platform/windows/platform.rs +++ b/crates/gpui/src/platform/windows/platform.rs @@ -813,8 +813,8 @@ unsafe fn show_savefile_dialog(directory: PathBuf) -> Result { fn begin_vsync_timer(vsync_event: HANDLE, timer_stop_event: OwnedHandle) { let vsync_fn = select_vsync_fn(); - std::thread::spawn(move || { - while vsync_fn(timer_stop_event.to_raw()) { + std::thread::spawn(move || loop { + if vsync_fn(timer_stop_event.to_raw()) { if unsafe { SetEvent(vsync_event) }.log_err().is_none() { break; }