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 #8108, c01a2e2: possible crash on loading TTD savegames with phantom oil rigs #8109
Conversation
c01a2e is the actual commit that swapped out SmallVector with std::vector, and changed the semantics of the erase function which causes this crash. |
* It was 3 (till 2.2) and later 5 (till 5.1). | ||
* Setting it unconditionally does not hurt. | ||
*/ | ||
Station::GetByTile(t)->airport.type = AT_OILRIG; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you modify the last sentence of the comment to something like this which explains why it's moved out of the if/else block like before:
DeleteOilRig asserts on the correct type, and setting it unconditionally does not hurt.
src/saveload/afterload.cpp
Outdated
@@ -2203,7 +2202,8 @@ bool AfterLoadGame() | |||
} | |||
|
|||
if (remove) { | |||
DeleteAnimatedTile(*tile); | |||
tile = _animated_tiles.erase(tile); | |||
MarkTileDirtyByTile(*tile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you even need to mark dirty tiles in afterlolad?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied over from DeleteAnimatedTile. But if it doesn't need that, I can remove this line.
7d5635a
to
2a2f080
Compare
2a2f080
to
4bdfe8e
Compare
4bdfe8e
to
5f13a08
Compare
5f13a08
to
b4e35fa
Compare
Need help with commit message. Also, I'm unsure if the iterator issue originated from ab711e6. Plz someone check.