Advertisement

Compiler crash, r1777 -> r1778

Started by May 03, 2014 09:02 PM
11 comments, last by j3p 10 years, 6 months ago

Hmm, actually there is a problem in your SCRIPTF_ExecuteAsync implementation.

The CScriptHandle type should be received by value, and not as a pointer. The call to AddRefScriptObject is also not needed (in fact, it doesn't do anything for the CScriptHandle type).

You see, the CScriptHandle is really a value type, and not a ref type. It represents an object handle, but it doesn't have a reference counter by itself (much as a handle itself doesn't have one).

The function should be like this:

static void SCRIPTF_ExecuteAsync(asIScriptFunction *pfunc, CScriptHandle ref, float t){
    //...
    pscript->Execute(pfunc,...,&ref); //basically finds a free context, prepares it and executes in a concurrent manner
}

No changes to how you register it with AngelScript.

Observe, you were able to use it the way you were before, because behind the scenes C++ will send the CScriptHandle as a reference since it is a complex type. C++ reference and pointers are equivalent in the native calling convention. But that was just luck on your part, and is most certainly not portable to rely on this. :)

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

I've fixed the asCScriptEngine::CreateScriptObjectCopy now (rev 1917) so it is able to use the copy constructor now. This it is able to a copy of the CScriptHandle even though the type doesn't have the opAssign method.

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
Alright, I changed that and it seems to be working now.
Thank you for your help. Sorry this turned out to be my personal buglog. laugh.png

This topic is closed to new replies.

Advertisement