When i call a funcdef that i retrieve from a class property, the stack is corrupted, causing a crash when the function accesses parameters passed to it.
This script code causes the problem:
funcdef void Callback( array<int>@ pArray );
class Class
{
private Callback@ m_pCallback;
Callback@ Callback
{
get const { return m_pCallback; }
}
Class( Callback@ pCallback )
{
@m_pCallback = @pCallback;
}
}
void CallbackFn( array<int>@ pArray )
{
uint uiLength = pArray.length(); //Crash occurs here
}
void test()
{
Class instance( @CallbackFn );
array<int> arr;
instance.Callback( @arr );
}
Replacing the direct use of the property with the following does not cause any problems:
Callback@ pCallback = instance.Callback;
pCallback( @arr );
An example program that causes the bug is attached.