From ccecfeb45ceaacf9e19b8099a35c70f73c11311c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 9 Feb 2017 01:34:07 +0100 Subject: [PATCH] - to avoid problems with the final garbage collection, the players' PendingWeapon needs to be cleared manually. This is because it can point to a non-standard value which the garbage collector cannot deal with during engine shutdown. --- src/dobjtype.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/dobjtype.cpp b/src/dobjtype.cpp index 34709cddc..25e27b846 100644 --- a/src/dobjtype.cpp +++ b/src/dobjtype.cpp @@ -2817,6 +2817,13 @@ void PClass::StaticShutdown () // This flags DObject::Destroy not to call any scripted OnDestroy methods anymore. bVMOperational = false; + // PendingWeapon must be cleared manually because it is not subjected to the GC if it contains WP_NOCHANGE, which is just RUNTIME_CLASS(AWWeapon). + // But that will get cleared here, confusing the GC if the value is left in. + for (auto &p : players) + { + p.PendingWeapon = nullptr; + } + // Unless something went wrong, anything left here should be class and type objects only, which do not own any scripts. bShutdown = true; TypeTable.Clear();