Exception Handling

Started by
0 comments, last by WitchLord 18 years, 11 months ago
The 1.10.1d docs has this to say about SetException.
Quote:Note that if your system function sets an exception, it should not return any object references because the engine will not release the returned reference.
The download page says this
Quote:If an application function that returns an object calls SetException() on the context, the object that is returned is not properly destroyed. This could lead to memory leaks or resource locks.
The docs lead me to believe that this bug only exists when returning by reference, but the download page contradicts this. Under what conditions does this happen? And, how is it different in 2.x?
Advertisement
The thing is that if the application function calls ctx->SetException(), the library will not treat the returned value. Thus if the application returns an object, or handle that should normally be freed, there will be a memory leak.

Thus it's not a good idea to call ctx->SetException() in application functions that return objects by value.

I'll try to clarify this in the documentation.

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