Skip to content

Fix intermittent drag-and-drop freezing on Windows #19772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zachbateman
Copy link

@zachbateman zachbateman commented Jun 21, 2025

Objective

Fixes #19030.

Since Bevy 0.15.3, there has been a bug on Windows where drag-and-drop will occasionally freeze the application where the only fix is to resize the window.

Solution

This adds a check for any window events being received when determining if a redraw is requested—specifically on Windows. A drag-and-drop event sets the self.window_event_received flag to true.

For non-Windows platforms, self.redraw_requested(event_loop) is always called, but the Windows-specific branch has checks that for some reason sometimes don't properly handle a drag-and-drop event (and maybe other types of events?).

I also tried replacing all of the WINIT_WINDOWS.with_borrow(...) with just self.redraw_requested(event_loop), and that fixes the problem too (and then matches the non-Windows behavior), but I assume the Windows-specific checks are otherwise there for a reason.

Note: I'm not sure why the freeze only sometimes occurred. This change fixes the specific drag-and-drop freeze problem, but there may be some sort of deeper bug/issue causing the strange behavior in the first place.

Testing

I could replicate the intermittent freeze on Windows 11 in the drag-and-drop example, and this change seems to fully fix that problem.


Showcase

Here is the existing intermittent freeze in action before the fix. While there is nothing in the drag-and-drop example window, the whole application is completely frozen until the window is resized.

Bevy.Drag.Drop.Bug_20250621.mp4

Copy link
Contributor

Welcome, new contributor!

Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨

@hukasu hukasu added C-Bug An unexpected or incorrect behavior O-Windows Specific to the Windows desktop operating system S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Bug An unexpected or incorrect behavior O-Windows Specific to the Windows desktop operating system S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Window freezes when FileDragAndDrop Event is triggered in the drag_and_drop example
2 participants