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
This commit is contained in:
张小白 2024-05-09 11:15:32 +08:00 committed by GitHub
parent 2e0811e113
commit 9772b7ac33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -813,8 +813,8 @@ unsafe fn show_savefile_dialog(directory: PathBuf) -> Result<IFileSaveDialog> {
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;
}