Jump to content
  • Advertisement
Sign in to follow this  
Jason Goepel

BUG: Multiple Registration of template type.

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

When registering a specialized array type twice I get an ACCESS VIOLATION.

 

engine->RegisterObjectType("array<int32>", 0, asOBJ_REF);

engine->RegisterObjectType("array<int>", 0, asOBJ_REF);

 

as_scriptengine.cpp: 1699

// Was the template instance type created before?
if( templateInstanceTypes[templateInstanceTypes.GetLength()-1] == mostRecentTemplateInstanceType ||
    mostRecentTemplateInstanceType == dt.GetObjectType() )
    // TODO: Should have a better error message
    return ConfigError(asNOT_SUPPORTED, "RegisterObjectType", name, 0);

templateInstanceTypes has a length of 0, so templateInstanceTypes[-1] produces the error.

 

The following modification seems to correct the issue.  Please confirm.

// Was the template instance type created before?
if( templateInstanceTypes.GetLength() == 0 ||
	templateInstanceTypes[templateInstanceTypes.GetLength()-1] == mostRecentTemplateInstanceType ||
    mostRecentTemplateInstanceType == dt.GetObjectType() )
    // TODO: Should have a better error message
    return ConfigError(asNOT_SUPPORTED, "RegisterObjectType", name, 0);

Share this post


Link to post
Share on other sites
Advertisement
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!