mirror of https://github.com/ZDoom/gzdoom.git
- 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
|
@ -142,21 +142,25 @@ void DCorpsePointer::OnDestroy ()
|
|||
TThinkerIterator<DCorpsePointer> iterator (STAT_CORPSEPOINTER);
|
||||
DCorpsePointer *first = iterator.Next ();
|
||||
|
||||
int prevCount = first->Count;
|
||||
|
||||
if (first == this)
|
||||
// During a serialization unwind the thinker list won't be available.
|
||||
if (first != nullptr)
|
||||
{
|
||||
first = iterator.Next ();
|
||||
}
|
||||
int prevCount = first->Count;
|
||||
|
||||
if (first != NULL)
|
||||
{
|
||||
first->Count = prevCount - 1;
|
||||
}
|
||||
if (first == this)
|
||||
{
|
||||
first = iterator.Next();
|
||||
}
|
||||
|
||||
if (first != NULL)
|
||||
{
|
||||
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 New Issue