Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17560

asCScriptEngine::FindNewOwnerForSharedType not handling template instances

$
0
0

The “asCModule::InternalReset()” function seems to correctly try finding new owners for template instances:

asCObjectType *type = templateInstances[n];
if( engine->FindNewOwnerForSharedType(type, this) != this ) …

but “asCScriptEngine::FindNewOwnerForSharedType” seems to be missing a case to handle this.
It looks like there should be an extra “else if” added:

int foundIdx = -1;
asCModule *mod = scriptModules[n];
if( mod == in_type->module ) continue;
if( in_type->flags & asOBJ_ENUM )
    foundIdx = mod->enumTypes.IndexOf(CastToEnumType(in_type));
else if (in_type->flags & asOBJ_TYPEDEF)
    foundIdx = mod->typeDefs.IndexOf(CastToTypedefType(in_type));
else if (in_type->flags & asOBJ_FUNCDEF)
    foundIdx = mod->funcDefs.IndexOf(CastToFuncdefType(in_type));
//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
else if(in_type->flags & asOBJ_TEMPLATE)
    foundIdx = mod->templateInstances.IndexOf(CastToObjectType(in_type));
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
else
    foundIdx = mod->classTypes …

Viewing all articles
Browse latest Browse all 17560

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>