- made all iterator classes natively abstract so that they do not get a ConstructNative method so that OP_NEW can refuse creating them without the need to mark them as abstract.

- block creation of actors with the 'new' instruction. Unlike the above these cannot be made abstract because without ConstructNative they cannot be serialized.
This commit is contained in:
Christoph Oelckers 2017-03-09 17:21:37 +01:00
commit 878e6015df
4 changed files with 18 additions and 5 deletions

View file

@ -811,7 +811,19 @@ begin:
{
b = B;
PClass *cls = (PClass*)(pc->op == OP_NEW ? reg.a[b] : konsta[b].v);
if (cls->ObjectFlags & OF_Abstract) ThrowAbortException(X_OTHER, "Cannot instantiate abstract class %s", cls->TypeName.GetChars());
if (cls->ConstructNative == nullptr)
{
ThrowAbortException(X_OTHER, "Class %s requires native construction", cls->TypeName.GetChars());
}
if (cls->ObjectFlags & OF_Abstract)
{
ThrowAbortException(X_OTHER, "Cannot instantiate abstract class %s", cls->TypeName.GetChars());
}
// Creating actors here must be outright prohibited,
if (cls->IsDescendantOf(RUNTIME_CLASS(AActor)))
{
ThrowAbortException(X_OTHER, "Cannot create actors with 'new'");
}
// [ZZ] validate readonly and between scope construction
c = C;
if (c) FScopeBarrier::ValidateNew(cls, c - 1);