Code: Select all
class TestHandler : StaticEventHandler
{
Array<MyClass> ar;
override void OnRegister()
{
ar.Insert(1, new('MyClass'));
}
}
class MyClass
{
}
Moderator: GZDoom Developers
Code: Select all
class TestHandler : StaticEventHandler
{
Array<MyClass> ar;
override void OnRegister()
{
ar.Insert(1, new('MyClass'));
}
}
class MyClass
{
}
It does, because the problem is with the insertion, and not with the generated code. The crash happens during a GC pass.Major Cooke wrote:Does it crash when you do the 'new' first as a variable and then insert it?
Also, just a note, Graf has said OnRegister should be avoided for everything except setting the order.