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

[GUI] File menu "exit" modal does not actually exit the program, while the corner [X] modal does. #1292

Closed
Sleet01 opened this issue Jul 29, 2023 · 1 comment · Fixed by #1295
Labels
Bug GUI User-interface related issue

Comments

@Sleet01
Copy link
Collaborator

Sleet01 commented Jul 29, 2023

Environment

Description

The exit prompt modal that appears when user selects File -> Exit does not exit MegaMekLab.
The exit prompt modal that appears when a user clicks on the [X] button in the top-right corner of the frame does exit.

Expectation:

  • Both methods instantiate the same modal with the same code and functionality.
  • Answering "Yes" or "No" in the Modal either saves, or does not, followed by exiting the program.

Actual:

  • They don't function the same.
  • Neither option in the first modal exits.

This affects both custom and cache-only units.
This happens whether the user selects "Yes" or "No", although the Save functionality does work in both modals.

Files

megamek.log

CLI debug logging for MML showing File -> Exit modal saving but not exiting, then [X] modal saving and exiting.

20230729_1605_mml_exit_issue.log

@Sleet01
Copy link
Collaborator Author

Sleet01 commented Jul 30, 2023

Cause is: menu entry's frame is the menu bar, while the exit button's frame is the main UI frame. Need to instantiate the Exit menu entry's exit call with the main UI frame somehow.

Actual cause: menu item "Exit" never actually calls System.exit(); it just returns a boolean that is dropped immediately and does nothing.

Proposed fix: wrap the existing lambda in a conditional exit function that will exit if that is appropriate.

Sleet01 added a commit to Sleet01/megameklab that referenced this issue Jul 30, 2023
Adds a conditional exit function to wrap the existing event handler that
never actually exits.

Close MegaMek#1292
Sleet01 added a commit to Sleet01/megameklab that referenced this issue Jul 30, 2023
Bring fix for MegaMek#1292 into fork's master.
@SJuliez SJuliez added Bug GUI User-interface related issue labels Jul 31, 2023
Sleet01 added a commit to Sleet01/megameklab that referenced this issue Aug 3, 2023
Adds a conditional exit function to wrap the existing event handler that
never actually exits.

Close MegaMek#1292
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug GUI User-interface related issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants