From 0aadfeb3c736eb64965a6fb252aea32199bf3a4d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 16 Mar 2008 20:57:46 +0000 Subject: [PATCH] - Fixed: FreshThinkers's max. index is MAX_STATNUM so the code shouldn't to access FreshThinkers[MAX_STATNUM+1]. SVN r808 (trunk) --- docs/rh-log.txt | 4 ++++ src/dthinker.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index b68ea7e7e..46c528914 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,7 @@ +March 16, 2008 (Changes by Graf Zahl) +- Fixed: FreshThinkers's max. index is MAX_STATNUM so the code shouldn't + to access FreshThinkers[MAX_STATNUM+1]. + March 15, 2008 - Fixed: The only time bestslideline is ever NULL is before it ever gets set. That means my P_BounceWall() from March 6 wasn't really correct. diff --git a/src/dthinker.cpp b/src/dthinker.cpp index f48cc6ae1..ef4ac0463 100644 --- a/src/dthinker.cpp +++ b/src/dthinker.cpp @@ -309,11 +309,12 @@ void DThinker::ChangeStatNum (int statnum) // Mark the first thinker of each list void DThinker::MarkRoots() { - for (int i = 0; i <= MAX_STATNUM+1; ++i) + for (int i = 0; i <= MAX_STATNUM; ++i) { GC::Mark(Thinkers[i].Sentinel); GC::Mark(FreshThinkers[i].Sentinel); } + GC::Mark(Thinkers[MAX_STATNUM+1].Sentinel); } // Destroy every thinker @@ -321,7 +322,7 @@ void DThinker::DestroyAllThinkers () { int i; - for (i = 0; i <= MAX_STATNUM+1; i++) + for (i = 0; i <= MAX_STATNUM; i++) { if (i != STAT_TRAVELLING) { @@ -329,6 +330,7 @@ void DThinker::DestroyAllThinkers () DestroyThinkersInList (FreshThinkers[i]); } } + DestroyThinkersInList (Thinkers[MAX_STATNUM+1]); GC::FullGC(); }