• Advertisement
Sign in to follow this  

Function release crash and wrong error message, maybe?

This topic is 1917 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,

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

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.
[CODE]
GC cannot free an object type of '_builtin_function_', it is kept alive by the application.
[/CODE]

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.

Share this post


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

Share this post


Link to post
Share on other sites
since func->AddRef(); and func->Release(); produce the same error, i will identify func->Release(); error by the crash from now on :)

Share this post


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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement