bevyengine / bevyengine/bevy

Inserting `Disabled` into a window causes the window to crash

Open
#20,864 6 comments 0 reactions 0 assignees View on GitHub
A-Windowing C-Bug S-Needs-Investigation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version and features

Commit: #a0a8f33c

## What you did

Spawn two windows and inserted `Disabled` into one of them

```rust
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, spawn_window)
.add_systems(Update, disable_window.run_if(input_just_pressed(KeyCode::Space)))
.run()
}

fn spawn_window(mut commands: Commands) {
commands.spawn((
SpecialWindow,
Window::default()
));
}

fn disable_window(window: Single>, mut commands: Commands) {
commands.entity(*window).insert(Disabled);
}
```

## What went wrong

Window is still visible.

Ui changes are still registered (BackgroundColor is the only one I've tested).

## Additional information

```
2025-09-04T13:05:41.222142Z WARN bevy_winit::state: Window 11v0 is missing `Window` component, skipping event RedrawRequested
2025-09-04T13:05:41.238862Z WARN bevy_winit::state: Window 11v0 is missing `Window` component, skipping event Focused(true)
2025-09-04T13:05:41.240607Z WARN bevy_winit::state: Window 11v0 is missing `Window` component, skipping event KeyboardInput { device_id: DeviceId(X(DeviceId(3))), event: KeyEvent { physical_key: Code(Tab), logical_key: Named(Tab), text: Some("\t"), location: Standard, state: Pressed, repeat: false, platform_specific: KeyEventExtra { text_with_all_modifiers: Some("\t"), key_without_modifiers: Named(Tab) } }, is_synthetic: true }
2025-09-04T13:05:41.240795Z WARN bevy_winit::state: Window 11v0 is missing `Window` component, skipping event ModifiersChanged(Modifiers { state: ModifiersState(0x0), pressed_mods: ModifiersKeys(0x0) })
2025-09-04T13:05:41.240841Z WARN bevy_winit::state: Window 11v0 is missing `Window` component, skipping event CursorMoved { device_id: DeviceId(X(DeviceId(2))), position: PhysicalPosition { x: -123.0, y: -135.0 } }
2025-09-04T13:05:41.240982Z WARN bevy_winit::state: Window 11v0 is missing `Window` component, skipping event ModifiersChanged(Modifiers { state: ModifiersState(0x0), pressed_mods: ModifiersKeys(0x0) })
2025-09-04T13:05:41.241351Z WARN bevy_winit::state: Window 11v0 is missing `Window` component, skipping event KeyboardInput { device_id: DeviceId(X(DeviceId(3))), event: KeyEvent { physical_key: Code(Tab), logical_key: Named(Tab), text: Some("\t"), location: Standard, state: Released, repeat: false, platform_specific: KeyEventExtra { text_with_all_modifiers: Some("\t"), key_without_modifiers: Named(Tab) } }, is_synthetic: true }
2025-09-04T13:05:41.241421Z WARN bevy_winit::state: Window 11v0 is missing `Window` component, skipping event Focused(false)
2025-09-04T13:05:41.242568Z WARN bevy_winit::state: Window 11v0 is missing `Window` component, skipping event RedrawRequested
2025-09-04T13:05:41.254476Z WARN bevy_winit::state: Window 11v0 is missing `Window` component, skipping event RedrawRequested
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the two-window example from the issue, inserting Disabled into the SpecialWindow entity and observing the reported visibility, UI updates, and bevy_winit::state warnings. Trace how Window and Disabled components are handled during window and UI processing; done means the disabled window is handled consistently without remaining visible or producing the missing-Window event warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.