Advertisement

Function release crash and wrong error message, maybe?

Started by October 21, 2012 08:11 PM
2 comments, last by WitchLord 11 years, 11 months ago
Hi,


asIScriptFunction *func = mod->GetFunctionByDecl("void main()");
ctx->Prepare(func);
ctx->Execute();
ctx->Unprepare();
ctx->Release();
func->Release();
engine->Release();


It is an error message followed by a crash.

func shouldn't be released here, but i did it by mistake.
Error message says the opposite of what happens here.

GC cannot free an object type of '_builtin_function_', it is kept alive by the application.


i looked around the code for an extra func->AddRef() for hours.
Did i misinterpret this error message?
or is this a bug?

Thank you.
The premature release of the function probably caused this problem. It's much the same as if you free memory too early. It can be difficult to predict the result after an error like that.

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
since func->AddRef(); and func->Release(); produce the same error, i will identify func->Release(); error by the crash from now on :)
If you have any idea how I can catch an incorrect call to Release() from the application I'd gladly implement it. It would definitely be good if the library could identify these kind of problems without the need to do exhaustive manual investigations.

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