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
Comments
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… |
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. |
For X11, it probably depends on the window manager. There's several possible ways that the 'X' button can work. |
Apparently the complaints weren't from Linux users but same as sevu I am using KWin on X11. |
While we might argue that that's not our fault, it's still annoying to the user. We could consider the following solutions:
|
I'm quite sure that this is wrong. |
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. |
Yeah, if it's only when not responding then it's not relevant here. |
Any further information on this? I didn't see any in the linked forum thread. I'm inclined to close this if not. |
I have relied on this feature to leave without waiting when I know I did not change preferences file. |
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. |
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? |
I do not need it as feature, it was just that nice exit takes long enough time waiting. |
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. |
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:
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. |
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. |
It probably relies on HDD to ensure saving takes long enough time. |
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).
The text was updated successfully, but these errors were encountered: