mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-25 13:41:05 +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,6 +142,9 @@ 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)
|
||||
|
@ -154,6 +157,7 @@ void DCorpsePointer::OnDestroy ()
|
|||
first->Count = prevCount - 1;
|
||||
}
|
||||
|
||||
}
|
||||
if (Corpse != NULL)
|
||||
{
|
||||
Corpse->Destroy();
|
||||
|
|
|
@ -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