-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Window intermittently crashes on Windows 10 & 11 on startup if setting a Window Icon using Winit #4010
Comments
This is caused by calling Solutions:
|
@aevyrie Excellent, this works a charm! Thanks very much for your explanation 😄 I'll open a PR to get this added to this page of the unofficial Cookbook: https://bevy-cheatbook.github.io/cookbook/window-icon.html |
Reopening because this is a problem we should fix directly :) |
# Objective - Fixes bevyengine#4010, as well as any similar issues in this class. - Winit functions used outside of the main thread can cause the application to unexpectedly hang. ## Solution - Make the `WinitWindows` resource `!Send`. - This ensures that any systems that use `WinitWindows` must either be exclusive (run on the main thread), or the resource is explicitly marked with the `NonSend` parameter in user systems.
Bevy version
Bevy 0.6.1
Winit 0.26.1
Operating system & version
Tested on Windows 10 and 11
What you did
main.rs
What you expected to happen
I expect the Window Icon at the top left hand corner of the application, and the window in the Task Bar to display the 16x16px png file located in the file assets/favicon.png. This should work 100% of the time.
What actually happened
This seems to work 50% of the time. Other times, the window opens with a blank white display, the default Windows window icon is shown, and the application is unresponsive. By clicking on the screen, Windows reports the application as (Not Responding).
The application never progresses after the call to window.set_window_icon(Some(icon)) .
Additional information
This isn't an issue with winit 0.26.1, as with the below code example just using Winit the issue doesn't occur, it works 100% of the time.
Also worth noting, when doing the below via Bevy, as soon as the window is rendered the icon is immediately there. However, when using the Bevy example above, the default Windows application Icon flashes up for a second or so, before the rest of the game loads - but that could well just be overhead of the engine.
I'm aware this is the workaround, and talks / progress around setting the Window Icon via Bevy is being discussed under #2268 - however currently this workaround doesn't seem to be an option either.
Cheers! 😄
The text was updated successfully, but these errors were encountered: