- fixed potential garbage collection of still referenced objects

Objects from dynamic array stored in items of array of structures were incorrectly treated as unreachable

https://forum.zdoom.org/viewtopic.php?t=61354
This commit is contained in:
alexey.lysiuk 2018-07-27 18:16:48 +03:00 committed by Christoph Oelckers
parent 7e69cd862e
commit e9041c0697
2 changed files with 18 additions and 0 deletions

View file

@ -1748,6 +1748,23 @@ void PArray::SetPointer(void *base, unsigned offset, TArray<size_t> *special)
}
}
//==========================================================================
//
// PArray :: SetPointerArray
//
//==========================================================================
void PArray::SetPointerArray(void *base, unsigned offset, TArray<size_t> *special)
{
if (ElementType->isStruct())
{
for (unsigned int i = 0; i < ElementCount; ++i)
{
ElementType->SetPointerArray(base, offset + ElementSize * i, special);
}
}
}
//==========================================================================
//
// NewArray

View file

@ -485,6 +485,7 @@ public:
void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special) override;
void SetPointer(void *base, unsigned offset, TArray<size_t> *special) override;
void SetPointerArray(void *base, unsigned offset, TArray<size_t> *ptrofs = NULL) override;
};
class PStaticArray : public PArray