Skip to content
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

WinitSettings::desktop_app() causes App to keep running after closing window #7624

Closed
akimakinai opened this issue Feb 11, 2023 · 2 comments
Closed
Labels
A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior

Comments

@akimakinai
Copy link
Contributor

Bevy version

master (de98850a)

What you did

use bevy::{prelude::*, winit::WinitSettings};

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .insert_resource(WinitSettings::desktop_app())
        .run();
}

Ran this code and tried closing window.

What went wrong

App does not exit immediately after window closing. It takes 60 seconds to exit in the end, probably for unfocused_mode.max_wait.

2023-02-11T09:42:27.025503Z  INFO bevy_winit::system: Creating new window "Bevy App" (0v0)
2023-02-11T09:42:30.939804Z  INFO bevy_winit::system: Closing window 0v0
2023-02-11T09:42:30.945907Z  WARN bevy_winit: Window 0v0 is missing `Window` component, skipping event ModifiersChanged((empty))
2023-02-11T09:42:30.946261Z  WARN bevy_winit: Window 0v0 is missing `Window` component, skipping event Focused(false)
2023-02-11T09:42:30.956528Z  WARN bevy_winit: Window 0v0 is missing `Window` component, skipping event Destroyed
2023-02-11T09:43:30.961131Z  INFO bevy_window::system: No windows are open, exiting

The problem disappears when removing WinitSettings::desktop_app() .

@akimakinai akimakinai added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Feb 11, 2023
@akimakinai
Copy link
Contributor Author

akimakinai commented Feb 11, 2023

close_when_requested seems to have moved to PostUpdate. Should it go into Update as before?

match self.exit_condition {
ExitCondition::OnPrimaryClosed => {
app.add_system_to_stage(CoreStage::PostUpdate, exit_on_primary_closed);
}
ExitCondition::OnAllClosed => {
app.add_system_to_stage(CoreStage::PostUpdate, exit_on_all_closed);
}
ExitCondition::DontExit => {}
}
if self.close_when_requested {
app.add_system(close_when_requested);
}

match self.exit_condition {
ExitCondition::OnPrimaryClosed => {
app.add_system(exit_on_primary_closed.in_set(CoreSet::PostUpdate));
}
ExitCondition::OnAllClosed => {
app.add_system(exit_on_all_closed.in_set(CoreSet::PostUpdate));
}
ExitCondition::DontExit => {}
}
if self.close_when_requested {
app.add_system(close_when_requested.in_set(CoreSet::PostUpdate));
}

@alice-i-cecile alice-i-cecile added A-Windowing Platform-agnostic interface layer to run your app in and removed S-Needs-Triage This issue needs to be labelled labels Feb 11, 2023
@alice-i-cecile
Copy link
Member

alice-i-cecile commented Feb 11, 2023

close_when_requested seems to have moved to PostUpdate. Should it go into Update as before?

Yes please, that seems like a good simple fix to try.

bors bot pushed a commit that referenced this issue Feb 13, 2023
# Objective

- `close_when_requested` system needs to run before `exit_on_*` systems, otherwise it takes another loop to exit app.
- Fixes #7624

## Solution

- Move `close_when_request` system to Update phase [as before](#7624 (comment)).
@bors bors bot closed this as completed in bf514ff Feb 13, 2023
myreprise1 pushed a commit to myreprise1/bevy that referenced this issue Feb 14, 2023
…7628)

# Objective

- `close_when_requested` system needs to run before `exit_on_*` systems, otherwise it takes another loop to exit app.
- Fixes bevyengine#7624

## Solution

- Move `close_when_request` system to Update phase [as before](bevyengine#7624 (comment)).
myreprise1 pushed a commit to myreprise1/bevy that referenced this issue Feb 15, 2023
…7628)

# Objective

- `close_when_requested` system needs to run before `exit_on_*` systems, otherwise it takes another loop to exit app.
- Fixes bevyengine#7624

## Solution

- Move `close_when_request` system to Update phase [as before](bevyengine#7624 (comment)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants