Advertisement

Virtual property compound assignment on temporary object handle (v2.30.0)

Started by February 24, 2015 02:24 AM
1 comment, last by WitchLord 9 years, 9 months ago

Just downloaded v2.30.0 for the virtual property compound assignment, and it's mostly great but there does seem to be an issue. Here's a snippet of the registration:


ASengine->RegisterObjectType("jjOBJ", sizeof(Omonster), asOBJ_REF | asOBJ_NOCOUNT );
ASengine->RegisterObjectMethod("jjOBJ", "uint16 get_creatorID() const", asFUNCTION(getCreatorID), asCALL_CDECL_OBJFIRST);
ASengine->RegisterObjectMethod("jjOBJ", "uint16 set_creatorID(uint16)", asFUNCTION(setCreatorID), asCALL_CDECL_OBJFIRST);
ASengine->RegisterGlobalFunction("jjOBJ @get_jjObjects(int)", asFUNCTION(getObject), asCALL_CDECL);

Given that, any of these run fine:


    jjObjects[0].creatorID = jjObjects[0].creatorID + 2;
//or
    jjOBJ@ obj = jjObjects[0];
    obj.creatorID = obj.creatorID + 2;
//or
    jjOBJ@ obj = jjObjects[0];
    obj.creatorID += 2;

But either of these versions produce a Null Pointer Access exception:


    jjObjects[0].creatorID += 2;
//or
    get_jjObjects(0).creatorID += 2;

The problem seems to exist for any function that returns a handle, even ones that aren't registered as get_*; that was just the easiest one to test given my existing registration. If creatorID is registered with RegisterObjectProperty instead, nothing goes wrong.

Thanks for the report. I'll look into it.

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

I've fixed this bug in revision 2137.

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