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

Fix #7635: Game crash on exit scenario editor. #7652

Merged
merged 1 commit into from Oct 7, 2019

Conversation

@stormcone
Copy link
Contributor

stormcone commented Jul 12, 2019

I think the GM_NORMAL is the only game mode when the station building widgets are available.

Copy link
Member

LordAro left a comment

Pretty sure this is good, but I wonder if it's complete - there are a lot of other references to != GM_EDITOR (in road_gui.cpp) that probably should be == GM_NORMAL instead
(this is the correct solution - see road_gui.cpp:722 for where the toolbar is created)

@stormcone

This comment has been minimized.

Copy link
Contributor Author

stormcone commented Jul 28, 2019

I think most of them could be == GM_NORMAL. The question is whether we want to narrow the possible game modes from != GM_EDITOR to == GM_NORMAL.

The actual problem here is that the _game_mode is set to GM_MENU before the windows are destroyed:

OpenTTD/src/openttd.cpp

Lines 322 to 329 in 425cd3e

static void LoadIntroGame(bool load_newgrfs = true)
{
_game_mode = GM_MENU;
if (load_newgrfs) ResetGRFConfig(false);
/* Setup main window */
ResetWindowSystem();

I checked the ResetGRFConfig and the ResetWindowSystem functions (and those they call) and I think it would be safe to put the _game_mode = GM_MENU; after the ResetWindowSystem();, because those functions do not depend on the game mode. So that could be an alternative solution.

@LordAro LordAro requested a review from PeterN Aug 3, 2019
@LordAro
LordAro approved these changes Oct 7, 2019
Copy link
Member

LordAro left a comment

This has been open way too long, this will do perfectly fine.

@LordAro LordAro merged commit 1e50295 into OpenTTD:master Oct 7, 2019
8 checks passed
8 checks passed
OpenTTD CI Build #20190712.2 succeeded
Details
OpenTTD CI (Linux commit-checker) Linux commit-checker succeeded
Details
OpenTTD CI (Linux linux-amd64-clang-3.8) Linux linux-amd64-clang-3.8 succeeded
Details
OpenTTD CI (Linux linux-amd64-gcc-6) Linux linux-amd64-gcc-6 succeeded
Details
OpenTTD CI (Linux linux-i386-gcc-6) Linux linux-i386-gcc-6 succeeded
Details
OpenTTD CI (MacOS) MacOS succeeded
Details
OpenTTD CI (Windows Win32) Windows Win32 succeeded
Details
OpenTTD CI (Windows Win64) Windows Win64 succeeded
Details
@stormcone stormcone deleted the stormcone:fix-7635 branch Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.