mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- fixed issues with uninitialized RNGs and bad assumptions about corpse pointers always being fully initialized when being destroyed.
Both of these may be true when occuring during normal gameplay, but not during an exception unwind in the serializer, which caused crashes if ACS errored out due to mismatched scripts.
This commit is contained in:
parent
15b95cc023
commit
08c252274a
2 changed files with 16 additions and 10 deletions
|
@ -142,11 +142,14 @@ void DCorpsePointer::OnDestroy ()
|
|||
TThinkerIterator<DCorpsePointer> iterator (STAT_CORPSEPOINTER);
|
||||
DCorpsePointer *first = iterator.Next ();
|
||||
|
||||
// During a serialization unwind the thinker list won't be available.
|
||||
if (first != nullptr)
|
||||
{
|
||||
int prevCount = first->Count;
|
||||
|
||||
if (first == this)
|
||||
{
|
||||
first = iterator.Next ();
|
||||
first = iterator.Next();
|
||||
}
|
||||
|
||||
if (first != NULL)
|
||||
|
@ -154,9 +157,10 @@ void DCorpsePointer::OnDestroy ()
|
|||
first->Count = prevCount - 1;
|
||||
}
|
||||
|
||||
}
|
||||
if (Corpse != NULL)
|
||||
{
|
||||
Corpse->Destroy ();
|
||||
Corpse->Destroy();
|
||||
}
|
||||
Super::OnDestroy();
|
||||
}
|
||||
|
|
|
@ -156,6 +156,7 @@ FRandom::FRandom ()
|
|||
#endif
|
||||
Next = RNGList;
|
||||
RNGList = this;
|
||||
Init(0);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -199,6 +200,7 @@ FRandom::FRandom (const char *name)
|
|||
|
||||
Next = probe;
|
||||
*prev = this;
|
||||
Init(0);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
Loading…
Reference in a new issue