- gracefully handle when a map tries to exit twice.

This case left a broken ScreenJobRunner behind which later crashed on garbage collection.
This commit is contained in:
Christoph Oelckers 2022-01-15 19:20:58 +01:00
parent 40cee808a1
commit 4b9ea92969
2 changed files with 3 additions and 1 deletions

View file

@ -195,7 +195,6 @@ static void GameTicker()
FX_StopAllSounds();
FX_SetReverb(0);
gi->LevelCompleted(g_nextmap, g_nextskill);
assert(gameaction != ga_nothing);
break;
case ga_nextlevel:

View file

@ -160,6 +160,7 @@ void ShowScoreboard(int numplayers, const CompletionFunc& completion_)
{
completion = completion_;
runner = CreateRunner();
Printf("Created runner at %p\n", runner);
GC::WriteBarrier(runner);
const char* qname = globalCutscenes.MPSummaryScreen;
@ -188,6 +189,8 @@ void ShowScoreboard(int numplayers, const CompletionFunc& completion_)
void ShowIntermission(MapRecord* fromMap, MapRecord* toMap, SummaryInfo* info, CompletionFunc completion_)
{
if (runner != nullptr)
return; // protection against double exits.
if (fromMap == toMap)
{
// don't show intermission when restarting the same level.