Sign in to follow this  
FDsagizi

Null pointer exception no show in destructor

Recommended Posts

Hi [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

This script:
[CODE]

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" );
}

[/CODE]
output:

Dest 1
End

Null pointer exception no show

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this