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

Wesnoth does not save preferences when closed by window managers 'X'-button #5142

Closed
sevu opened this issue Sep 8, 2020 · 18 comments
Closed
Labels
Bug Issues involving unexpected behavior. Engine General game engine issues that do not fit in any other category. Needs more info Issues deemed to contain insufficient information for reproducing or fixing. Unconfirmed Issues that no developer was able to reproduce.

Comments

@sevu
Copy link
Member

sevu commented Sep 8, 2020

Wesnoth saves the preferences when quitting. Seems it's not everywhere case when quitting via the top-right X-Button.

In my tests on Linux with KDE and X11 it worked. But what indicates it's not for everybody the case:

Maybe it only happens on Windows or Mac.

For testing, I used the chat command /friend someone, and checked if it is in the savefile after closing Wesnoth. Tried both closing Wesnoth with the X and confirming the popup, and by clicking the X button multiple times instead (which closes Wesnoth regardless of the popup).

@sevu sevu added Bug Issues involving unexpected behavior. Needs more info Issues deemed to contain insufficient information for reproducing or fixing. Engine General game engine issues that do not fit in any other category. labels Sep 8, 2020
@CelticMinstrel
Copy link
Member

At least on Windows, I believe clicking the X multiple times kills the application rather than just sending it a quit message, so that particular part of the test might not be relevant…

@Wedge009
Copy link
Member

Wedge009 commented Sep 9, 2020

Need to find out what the specific cases of 'not working' are. I just checked a change of language and using the window manager 'X' was equivalent to the Quit menu button in both Windows and Linux. I was using the 1.14.13 release.

@stevecotton
Copy link
Contributor

For X11, it probably depends on the window manager. There's several possible ways that the 'X' button can work.

@Wedge009
Copy link
Member

Wedge009 commented Sep 9, 2020

Apparently the complaints weren't from Linux users but same as sevu I am using KWin on X11.

@AI0867
Copy link
Member

AI0867 commented Sep 14, 2020

At least on Windows, I believe clicking the X multiple times kills the application rather than just sending it a quit message, so that particular part of the test might not be relevant…

While we might argue that that's not our fault, it's still annoying to the user. We could consider the following solutions:

  • saving on change
  • preemptively saving before we show the confirmation window

@gfgtdf
Copy link
Contributor

gfgtdf commented Sep 14, 2020

At least on Windows, I believe clicking the X multiple times kills the application rather than just sending it a quit message, so that particular part of the test might not be relevant…

I'm quite sure that this is wrong.

@CelticMinstrel
Copy link
Member

It's a simplification of what happens, but it's definitely possible to force-kill a Windows application by clicking the X button. It might only work if the application is not responding though? I'm not quite sure.

@gfgtdf
Copy link
Contributor

gfgtdf commented Sep 14, 2020

It's a simplification of what happens, but it's definitely possible to force-kill a Windows application by clicking the X button. It might only work if the application is not responding though? I'm not quite sure.

Yes it is possible if the application is not responding but that unrelated to the issue here.

@CelticMinstrel
Copy link
Member

Yeah, if it's only when not responding then it's not relevant here.

@Wedge009 Wedge009 added the Unconfirmed Issues that no developer was able to reproduce. label Sep 24, 2021
@Wedge009
Copy link
Member

Any further information on this? I didn't see any in the linked forum thread. I'm inclined to close this if not.

@ProditorMagnus
Copy link
Contributor

I have relied on this feature to leave without waiting when I know I did not change preferences file.

@AI0867
Copy link
Member

AI0867 commented Sep 27, 2021

It's undocumented (besides bug reports and occasional forum threads, I expect) behaviour that is hardly intuitive. It can be useful for people who understand it, but I expect it's more frequently a cause of issues for people who don't.

If I didn't know the internals, I would expect the method I use to quit the game not to affect whether the preferences are saved, unless (or even if!) I force-quit/kill/crash the game. (one might expect the preferences to be saved the moment you exit the preferences menu, rather than on exit)

If being able to change preferences without saving is a feature that we (probably just the devs) want, it would be better to make it an explicit, if hidden, feature.

@stevecotton
Copy link
Contributor

All the comments before the bug report was closed were that it was an intermittent bug with the root cause not yet identified, but the last two comments suggest it's a fully understood (but undocumented) feature.

@AI0867, please would you add some details about what the internals are here?

@ProditorMagnus
Copy link
Contributor

I do not need it as feature, it was just that nice exit takes long enough time waiting.

@AI0867
Copy link
Member

AI0867 commented Sep 27, 2021

All the comments before the bug report was closed were that it was an intermittent bug with the root cause not yet identified, but the last two comments suggest it's a fully understood (but undocumented) feature.

@AI0867, please would you add some details about what the internals are here?

Not sure if it's still the case, but:

The internals are IIRC, fairly simple: the preferences are stored in a class that is initialized from the preferences file, optionally modified by commandline arguments, and then more by the preferences menu, kept in memory, and finally written to disk during a clean, regular exit, which for some reason (probably rigid internals), a window manager quit event isn't or wasn't, in every case.

If it still exists, but not generally, I would expect this to be during modal dialogs.

@Wedge009
Copy link
Member

It's been a while since I looked into this in detail, but my recollection is that Preferences are saved in memory (remain active for as long as Wesnoth remains open) while they are only written to disk once Wesnoth closes - this seems to match the description above. In my experience, I have been unable to exit Wesnoth without having the Preferences written to disk irrespective if the game was closed via:

  • Exit button from main menu
  • Exit menu item during a game
  • Keyboard short-cut for closing windows (including Ctrl+Q and Alt+F4)
  • Clicking the window's 'X' button

This applies to Windows and Linux. Short of forcing an abnormal program termination via the OS process manager, I don't recall encountering this issue.

@stevecotton
Copy link
Contributor

I normally launch Wesnoth from a Linux command line, and if I'm testing often exit with a Ctrl+C on that command line. There was a long time when that would intermittently deadlock in SDL's cleanup routines, which would be a possible root cause of this issue too.

However, it was rare and the response to Ctrl-C didn't seem a priority to debug.

@ProditorMagnus
Copy link
Contributor

It probably relies on HDD to ensure saving takes long enough time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues involving unexpected behavior. Engine General game engine issues that do not fit in any other category. Needs more info Issues deemed to contain insufficient information for reproducing or fixing. Unconfirmed Issues that no developer was able to reproduce.
Projects
None yet
Development

No branches or pull requests

7 participants