Jump to content
  • Advertisement
Sign in to follow this  
FDsagizi

Null pointer exception no show in destructor

This topic is 1617 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!