Jump to content
  • Advertisement
Sign in to follow this  
Violet CLM

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

This topic is 1386 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

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;
    jjOBJ@ obj = jjObjects[0];
    obj.creatorID = obj.creatorID + 2;
    jjOBJ@ obj = jjObjects[0];
    obj.creatorID += 2;

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

    jjObjects[0].creatorID += 2;
    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.

Share this post

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!