🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Strange question about SetExceptionCallback

Started by
2 comments, last by WitchLord 18 years, 5 months ago
I have not debugged this entirely, but I thought I would post here in the hopes that someone might have seen this before and save me some trouble. :) Let me explain the behavior I am seeing... I have wrapped my engine contexts in objects that do the management of the contexts and cleanup as well as handle exception reporting. In the object constructor I set the exception callback to a method of that object. When a script exception occurs I see that my assigned method is called and completed, but my application terminates when control returns to asCScriptEngine::CallObjectMethod. Here is the strange part. If I wrap ( asScriptEngine.cpp line 2207 )
(((asCSimpleDummy*)obj)->*f)(param);
in a try/catch, like this:
try
{
    (((asCSimpleDummy*)obj)->*f)(param);
}
catch(...)
{

}
Erything works perfectly. In fact, the catch never gets executed, but without it the app faults and dies. At first I suspected that my object containing the assigned exception callback was being cleaned up before the call had completed but I am sure it is around well after this call. Does this situation look familiar to anyone? My gut says I have some kind of object lifetime problem going on, since I do not see this problem if I set my callback to a global function. Thanks, ~Scott
[size=1]'Behold! It is not over unknown seas but back over well-known years that your quest must go; back to the bright strange things of infancy and the quick sun-drenched glimpses of magic that old scenes brought to wide young eyes.'
Advertisement
It's possible that this is a bug in AngelScript.

Could you answer a couple of questions so that I can more easily investigate this:

- What version of AngelScript are you using?
- How exactly are you setting the exception callback? Show me the parameters used in the call to SetExceptionCallback().
- What is the function signature for the callback method you're setting?

Thanks,
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

Thanks Andreas...

I was using AngelScript 2.5.0

But I actually found the problem , just because of the questions you asked me I looked closer at how I was setting the ExceptionCallback and saw that my class had defined two functions with the same name but different signatures and I was using SetExceptionCallback with the method name that matched both, and that was causing the exception to occur.

Thanks again.. sorry for the trouble.

~Scott
[size=1]'Behold! It is not over unknown seas but back over well-known years that your quest must go; back to the bright strange things of infancy and the quick sun-drenched glimpses of magic that old scenes brought to wide young eyes.'
Ok. Thanks for letting me know. :)

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