Openapoc: [Crash] on a alien spotted mission (Segmentation fault)

Created on 9 Mar 2019  ·  5Comments  ·  Source: OpenApoc/OpenApoc

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=,

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=)

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=, argv=)

at /home/atrosha/OpenApoc/game/main.cpp:26`
!BUG! HIGH PRIORITY !BUG! low priority

Most helpful comment

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.

All 5 comments

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

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

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.

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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FilmBoy84 picture FilmBoy84  ·  3Comments

muton-commander picture muton-commander  ·  3Comments

emc2 picture emc2  ·  3Comments

FilmBoy84 picture FilmBoy84  ·  3Comments

FilmBoy84 picture FilmBoy84  ·  3Comments