windows: Fix `Zed` freezing when resuming from sleep (#11589)

张小白 created

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

Change summary

crates/gpui/src/platform/windows/platform.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Detailed changes

crates/gpui/src/platform/windows/platform.rs 🔗

@@ -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;
             }