Skip to content

Commit

Permalink
Clear Services Map during VM Shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoLuis0 authored and coelckers committed Jun 28, 2023
1 parent a8b8de9 commit 71d4eb6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/common/objects/dobjtype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,16 @@ void PClass::StaticInit ()
//
//==========================================================================

void ClearServices();

void PClass::StaticShutdown ()
{
if (WP_NOCHANGE != nullptr)
{
delete WP_NOCHANGE;
}

ClearServices();
// delete all variables containing pointers to script functions.
for (auto p : FunctionPtrList)
{
Expand Down
9 changes: 7 additions & 2 deletions src/common/scripting/interface/vmnatives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@

static ZSMap<FName, DObject*> AllServices;

static void MarkServices() {

static void MarkServices()
{
ZSMap<FName, DObject*>::Iterator it(AllServices);
ZSMap<FName, DObject*>::Pair* pair;
while (it.NextPair(pair))
Expand All @@ -82,6 +82,11 @@ void InitServices()
GC::AddMarkerFunc(&MarkServices);
}

void ClearServices()
{
AllServices.Clear();
}



//==========================================================================
Expand Down

0 comments on commit 71d4eb6

Please sign in to comment.