-
-
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
Multiple windows example panics when closing one of the windows #11236
Comments
I'm now getting the same error on main (06bf928) on |
I couldn't reproduce this on the latest main (e3126a4). After Running the multiple windows example and closing one of them, I got this: 2024-02-01T09:28:37.133424Z INFO log: GENERAL [Loader Message (0x0)]
Using "NVIDIA GeForce RTX 3060 Laptop GPU" with driver: "libGLX_nvidia.so.0"
2024-02-01T09:28:37.133429Z INFO log: objects: (type: INSTANCE, hndl: 0x5614e9dd3b60, name: ?)
2024-02-01T09:28:37.717473Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux rolling Arch Linux", kernel: "6.7.2-zen1-1-zen", cpu: "", core_count: "14", memory: "31.1 GiB" }
2024-02-01T09:28:37.758296Z INFO bevy_winit::system: Creating new window "Second window" (4v1)
2024-02-01T09:28:37.758494Z INFO log: Guessed window scale factor: 2
2024-02-01T09:28:38.394059Z INFO log: GENERAL [NVIDIA (0x4)]
Requested image extent (2560x1440) does not match surface (2560x1468), marking swapchain out of date
2024-02-01T09:28:38.394196Z INFO log: objects: (type: SWAPCHAIN_KHR, hndl: 0x5614efebcb00, name: ?)
2024-02-01T09:28:38.427726Z INFO log: GENERAL [NVIDIA (0x4)]
Requested image extent (2560x1440) does not match surface (2560x1468), marking swapchain out of date
2024-02-01T09:28:38.427760Z INFO log: objects: (type: SWAPCHAIN_KHR, hndl: 0x5614efd18020, name: ?)
2024-02-01T09:28:49.233193Z INFO log: GENERAL [NVIDIA (0x4)]
Requested image extent (2560x1468) does not match surface (1920x1440), marking swapchain out of date
2024-02-01T09:28:49.233231Z INFO log: objects: (type: SWAPCHAIN_KHR, hndl: 0x5614efd18020, name: ?)
2024-02-01T09:28:50.141623Z INFO bevy_winit::system: Closing window 4v1
2024-02-01T09:28:50.174612Z WARN bevy_winit: Window 4v1 is missing `Window` component, skipping event RedrawRequested
2024-02-01T09:28:50.175029Z WARN bevy_winit: Window 4v1 is missing `Window` component, skipping event Destroyed It seems fixed now. |
I am still getting a panic on Though specifically: Only when closing "Second window" first. If I close "First window". It keeps running, but the text on the second window changes from "Second window" to "Second" and the font gets smaller. That's what I get if I close the second window first:
Still getting the error on
|
I managed to trigger something similar to this last night in a multi-window app while sending close window via keyboard(same as window close button), to the second window, in my case the application live-locked and the first window never continued rendering.
Even gracefully despawning a second window causes this for me, so it's not related to sending a window close command manually as above. |
I am also encountering this error in a basic "initial window" app. use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn(Camera2dBundle::default());
} Clicking the X to close the window results in the error below:
|
… using pipelined rendering (#12978) # Objective A `RawWindowHandle` is only valid as long as the window it was retrieved from is alive. Extend the lifetime of the window, so that the `RawWindowHandle` doesn't outlive it, and bevy doesn't crash when closing a window a pipelined renderer is drawing to. - Fix #11236 - Fix #11150 - Fix #11734 - Alternative to / Closes #12524 ## Solution Introduce a `WindowWrapper` that takes ownership of the window. Require it to be used when constructing a `RawHandleWrapper`. This forces windowing backends to store their window in this wrapper. The `WindowWrapper` is implemented by storing the window in an `Arc<dyn Any + Send + Sync>`. We use dynamic dispatch here because we later want the `RawHandleWrapper` to be able dynamically hold a reference to any windowing backend's window. But alas, the `WindowWrapper` itself is still practically invisible to windowing backends, because it implements `Deref` to the underlying window, by storing its type in a `PhantomData`. --- ## Changelog ### Added - Added `WindowWrapper`, which windowing backends are now required to use to store their underlying window. ### Fixed - Fixed a safety problem which caused crashes when closing bevy windows when using pipelined rendering. ## Migration Guide - Windowing backends now need to store their window in the new `WindowWrapper`.
What you did
multiple_windows
example withcargo run --example multiple_windows
.What went wrong
Closing a window results in a panic with the following error:
Additional information
Probably related to #10702
The text was updated successfully, but these errors were encountered: