Advertisement

Null pointer exception no show in destructor

Started by September 30, 2012 11:49 AM
1 comment, last by WitchLord 10 years, 6 months ago
Hi smile.png

This script:


class TestGC
{
TestGC @child;

~TestGC()
{
output( "Dest 1" );

child.Do();

output( "Dest 2" );
}
void Do(){}
}

void startGame()
{
TestGC @gc = TestGC();

@gc = null;



scene.RunGC();

output( "End" );
}


output:

Dest 1
End

Null pointer exception no show
As the destructor isn't necessarily called at the moment when the object goes out of scope, but only the last reference to it is released, any exception that occurs in the destructor isn't shown in the normal execution.

I'll look into how to make it possible to detect exceptions in the destructor for a future release.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

I've implemented the support for having the engine request a context from the application in revision 1929.

For this to work the application needs to implement two callbacks and register them with engine->SetRequestContextCallback and SetReturnContextCallback.

With this, the application will be able to setup the context with what it needs to catch the exceptions, debug the script, etc. It can also be used to provide memory pooling for contexts, to improve performance.

Regards,

Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement