View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0000787 | OpenClonk | Engine - GUI | public | 2012-05-28 14:45 | 2017-08-20 11:38 | ||||||||
Reporter | Isilkor | ||||||||||||
Assigned To | |||||||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||||||
Status | acknowledged | Resolution | open | ||||||||||
Platform | OS | Win32 | OS Version | ||||||||||
Product Version | |||||||||||||
Target Version | 9.0 | Fixed in Version | |||||||||||
Summary | 0000787: Closing the window while in C4Startup init code accesses invalid memory | ||||||||||||
Description | Closing the game window sends a WM_CLOSE message, the handler of which unloads C4Startup. This breaks the initialization code of C4StartupGraphics because it does not check whether its instance is still valid. | ||||||||||||
Steps To Reproduce | 1. Start OpenClonk in windowed mode 2. With the progress bar higher than 38%, press Alt+F4 3. OpenClonk crashes with an access violation. | ||||||||||||
Tags | No tags attached. | ||||||||||||
Attached Files |
|
![]() |
|
Newton (administrator) 2013-12-17 16:55 |
Hm I can reproduce this but I do not understand what is the issue with the code. Is the deconstructor (tried to be) called twice? If yes, seeing the second call in the stacktrace, when was the first call? Also, if this comes down to having to ensure on every call of pInstance that pInstance is still there, the better solution would be to delay the unloading on receiving the WM_CLOSE message until everything was loaded so that there is only one path of execution we have to make sure works. |
Isilkor (developer) 2013-12-18 11:59 |
A better solution would in my opinion be to save the important stuff (maybe config and any loaded players) when WM_CLOSE hits, and then just exit(0) without calling dtors. That way we'd also avoid having to do any deinitialization, which is superfluous anyway because we're exiting the process immediately after. |
Newton (administrator) 2013-12-20 11:26 |
What needs to be saved when the game is closed on startup? Also, I thought that config & loaded players are saved right when I selected it in the options / player selection(?) |
Isilkor (developer) 2013-12-20 15:24 |
> What needs to be saved when the game is closed on startup? Well, I want to avoid writing a special case for "WM_CLOSE during startup" and just do a quick teardown for all WM_CLOSE messages. > Also, I thought that config & loaded players are saved right when I selected it in the options / player selection(?) Might be, but it's certainly also saved when the application quits: https://git.openclonk.org/openclonk.git/blob/ac4ac045581f4ec8ffd763f973bff1ca02f00041:/src/game/C4Application.cpp#l596 |
Newton (administrator) 2013-12-21 05:02 |
Yes, I really wonder why. Looking into the source, the config is saved: + On startup (to fill in default config on first start after install or fix corrupted config) + On pressing [OK] after resolution change + On closing the option dialogue + On exit of the program I propose this solution for the config saving: + remove config save on exit of program + add config save on end of a round (because in a round, the player can change the config) |
![]() |
|||
Date Modified | Username | Field | Change |
---|---|---|---|
2012-05-28 14:45 | Isilkor | New Issue | |
2013-12-17 16:55 | Newton | Note Added: 0002835 | |
2013-12-17 16:56 | Newton | Status | new => acknowledged |
2013-12-18 11:59 | Isilkor | Note Added: 0002838 | |
2013-12-20 11:26 | Newton | Note Added: 0002842 | |
2013-12-20 15:24 | Isilkor | Note Added: 0002843 | |
2013-12-21 05:02 | Newton | Note Added: 0002844 | |
2015-10-16 00:33 | Sven2 | Target Version | => 7.0 |
2016-01-02 19:43 | Clonkonaut | Severity | major => minor |
2016-01-02 19:43 | Clonkonaut | Target Version | 7.0 => 8.0 |
2017-08-20 11:38 | Zapper | Target Version | 8.0 => 9.0 |