Advertisement

Segfault when binding function which takes script-array param

Started by January 28, 2014 02:01 AM
10 comments, last by iraxef 10 years, 10 months ago

Thanks a lot for the file

I managed to reproduce the problem with the following test:

engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
engine->SetMessageCallback(asMETHOD(COutStream, Callback), &out, asCALL_THISCALL);
 
RegisterScriptArray(engine, false);
 
engine->SetDefaultNamespace("gfx");
 
engine->RegisterObjectType("GfxSprite", 0, 1);
engine->RegisterObjectMethod("GfxSprite", "array<gfx::GfxSprite@>@ GetChildren() const", asFUNCTION(0), asCALL_GENERIC);
 
r = engine->RegisterObjectMethod("GfxSprite", "void Foo(const array<float> &in)", asFUNCTION(0), asCALL_CDECL_OBJLAST);
 
engine->Release();

The condition that hit the bug was that you were registering two (or more) methods on the same type that had arrays as parameters or return types + that you were using namespaces. In this particular situation the code picked the wrong type as the template type and instead tried to create the new template instance based on the previous template instance.

I've fixed the bug in revision 1826.

I also took the opportunity to change the code so that you no longer need to prefix the sub-type in the array with the namespace. :)

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

Confirmed (with revision 1826) that the desired C++ function binds now without issue. Thank you!!!

This topic is closed to new replies.

Advertisement