Assertion failure in as_configgroup.cpp
I hit the following assertion failure upon config group shutdown (v 2.2.2): http://www.foopics.c...844c3d87c9d3257
It seems to be related to string factory method/function somehow. What this assertion failure might indicate?
Do you know how to reproduce the problem? I'll need to know this in order to debug it and fix the code.
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
I'll need help to narrow it down. As it is now I have no idea what the problem might be.
Is it possible for you to create a small test that reproduce the problem?
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
asASSERT(index < length);
in asCArray<T>::operator []
The values for index and length are 388 and 76 respectively.
This is the faulty line:
return registeredGlobalFuncs[id];
in asCScriptEngine::GetGlobalFunctionByDecl
return scriptFunctions[id];
I've checked in this fix in revision 1115.
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
Basically, I wanted to be able to call function pointer in this manner:
other.pain( other, ent, 10.9, 10.0 );
for objects that had the .pain callback set in the C code (in the game not all of the game objects are controlled through scripting). For that, I created a proxy function:
void G_CallPain( edict_t *ent, edict_t *attacker, float kick, float damage )
{
if( ent->pain )
ent->pain( ent, attacker, kick, damage );
else if( ent->scriptSpawned && ent->asPainFunc )
G_asCallMapEntityPain( ent, attacker, kick, damage );
}
, registered it in AS as a global function and then set the asPainFunc function pointer in AddRef method like this:
if( !obj->scriptSpawned ) {
obj->asPainFunc = asEntityCallPainFuncPtr;
The key thing is that asPainFunc also holds the .pain function pointer set from the script.
I'll make some new tests with this info and see if it allows me to reproduce the problem.
How is the G_CallPain function registered? It is a global function in the application but you seem to call it as if it was an object method in the script.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
{
asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
engine->BeginConfigGroup("gr");
engine->RegisterObjectType("type", 0, asOBJ_REF);
engine->RegisterObjectBehaviour("type", asBEHAVE_FACTORY, "type @f()", asFUNCTION(Type::Factory), asCALL_CDECL);
engine->RegisterObjectBehaviour("type", asBEHAVE_ADDREF, "void f()", asMETHOD(Type,AddRef), asCALL_THISCALL);
engine->RegisterObjectBehaviour("type", asBEHAVE_RELEASE, "void f()", asMETHOD(Type,Release), asCALL_THISCALL);
engine->RegisterFuncdef("void fun(type @, int)");
engine->RegisterObjectProperty("type", "fun @callback", asOFFSET(Type,callback));
engine->EndConfigGroup();
asIScriptModule *mod = engine->GetModule("mod", asGM_ALWAYS_CREATE);
mod->AddScriptSection("s",
"void func(type @, int) {} \n"
"void main() \n"
"{ \n"
" type t; \n"
" @t.callback = func; \n"
" t.callback(t, 1); \n"
"} \n");
int r = mod->Build();
if( r < 0 )
TEST_FAILED;
r = ExecuteString(engine, "main()", mod);
if( r != asEXECUTION_FINISHED )
TEST_FAILED;
engine->Release();
}
The test passed without any problems, so I'm obviously missing something.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game