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

[Crash] on a alien spotted mission (Segmentation fault) #528

Closed
Atrosha opened this issue Mar 9, 2019 · 5 comments
Closed

[Crash] on a alien spotted mission (Segmentation fault) #528

Atrosha opened this issue Mar 9, 2019 · 5 comments
Labels
!BUG! HIGH PRIORITY Crashes the game! A serious issue stopping game progress or losing data. Needs a fix finding ASAP! !BUG! low priority This is a bug in OpenApoc. It will need resolving when time allows. It does not always cause a CTD

Comments

@Atrosha
Copy link
Contributor

Atrosha commented Mar 9, 2019

Crash during the mission in real time mode

gdb listing
Thread 1 "main" received signal SIGSEGV, Segmentation fault. OpenApoc::BattleHazard::update (this=0x60000000d, state=..., ticks=1) at /home/atrosha/OpenApoc/game/state/battle/battlehazard.cpp:490 490 if (ticksUntilVisible > 0) (gdb) info stack #0 OpenApoc::BattleHazard::update (this=0x60000000d, state=..., ticks=1) at /home/atrosha/OpenApoc/game/state/battle/battlehazard.cpp:490 #1 0x00000000007378f1 in OpenApoc::Battle::update (this=<optimized out>, state=..., ticks=1) at /home/atrosha/OpenApoc/game/state/battle/battle.cpp:1675 #2 0x00000000008aa757 in OpenApoc::GameState::update (this=0x5989410, ticks=1) at /home/atrosha/OpenApoc/game/state/gamestate.cpp:959 #3 0x000000000052bf2d in OpenApoc::BattleView::update (this=<optimized out>) at /home/atrosha/OpenApoc/game/ui/tileview/battleview.cpp:1443 #4 0x00000000004569b8 in OpenApoc::Framework::run (this=0xfd14d0, initialStage=...) at /home/atrosha/OpenApoc/framework/framework.cpp:584 #5 0x000000000043a1d4 in main (argc=<optimized out>, argv=<optimized out>) at /home/atrosha/OpenApoc/game/main.cpp:26

@JonnyH
Copy link
Collaborator

JonnyH commented Mar 10, 2019

Hmm, looks like the BattleHazard::update() is being called on a junk object -0x60000000d doesn't look sane for a heap pointer....

@FilmBoy84 FilmBoy84 added !BUG! low priority This is a bug in OpenApoc. It will need resolving when time allows. It does not always cause a CTD !BUG! HIGH PRIORITY Crashes the game! A serious issue stopping game progress or losing data. Needs a fix finding ASAP! labels Mar 15, 2019
@FranciscoDA
Copy link
Contributor

I think this is caused by an invalidated iterator: BattleHazard::update may end up calling BattleHazard::expand, which in turn can call die() on a nearby BattleHazard. If the destroyed hazard happens to be the next one in the iteration, then the iterator used in Battle::update becomes invalid (see https://en.cppreference.com/w/cpp/container/set/erase)

This is the only explanation I can think of

@Atrosha
Copy link
Contributor Author

Atrosha commented Mar 18, 2019

#529 causes game to crash more often on that mission. But nobody react on it. ehhh...

Also, I was finished that mission in realtime mode without any errors later.

So strange.

@FranciscoDA
Copy link
Contributor

FranciscoDA commented Mar 18, 2019

#536 might fix this but it will be hard to test since this bug occurs once in a blue moon. We should close this issue once we merge the pull request and reopen if the bug persists.

@Atrosha
Copy link
Contributor Author

Atrosha commented Mar 18, 2019

Nice and fast response. Can I mention you in my next video?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
!BUG! HIGH PRIORITY Crashes the game! A serious issue stopping game progress or losing data. Needs a fix finding ASAP! !BUG! low priority This is a bug in OpenApoc. It will need resolving when time allows. It does not always cause a CTD
Projects
None yet
Development

No branches or pull requests

4 participants