From 465792df0a0243c8ae4cc3925c056d85db319891 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 26 Aug 2016 02:16:06 +0200 Subject: [PATCH] - make sure that after travelling has finished, no travelling thinkers are left in the list. Since this list is excluded from regular thinker cleaning, anything that may survive through the end of G_FinishTravel will endlessly multiply and severely break the following savegames or just simply crash on broken pointers. --- src/dthinker.h | 5 +++++ src/g_level.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/dthinker.h b/src/dthinker.h index 10a53309d6..855c3c9ad9 100644 --- a/src/dthinker.h +++ b/src/dthinker.h @@ -77,6 +77,11 @@ public: static void RunThinkers (int statnum); static void DestroyAllThinkers (); static void DestroyMostThinkers (); + static void DestroyThinkersInList(int statnum) + { + DestroyThinkersInList(Thinkers[STAT_TRAVELLING]); + DestroyThinkersInList(FreshThinkers[STAT_TRAVELLING]); + } static void SerializeAll (FArchive &arc, bool keepPlayers); static void MarkRoots(); diff --git a/src/g_level.cpp b/src/g_level.cpp index e47cbb4a55..60e9b06990 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1295,6 +1295,11 @@ void G_FinishTravel () } bglobal.FinishTravel (); + + // make sure that, after travelling has completed, no travelling thinkers are left. + // Since this list is excluded from regular thinker cleaning, anything that may survive through here + // will endlessly multiply and severely break the following savegames or just simply crash on broken pointers. + DThinker::DestroyThinkersInList(STAT_TRAVELLING); } //==========================================================================