I've been writing a generalized voidPtr class for angelScript, because in many cases,I won't know the type of the object I'm sending, hence I'll have to cast the object based on what the other person decides to retrieve. So, I've been looking though cScriptAny.
cScriptAny's Store() function does this:
else if( value.typeId & asTYPEID_MASK_OBJECT )
{
// Create a copy of the object
value.valueObj = engine->CreateScriptObjectCopy(ref, value.typeId);
}
Now, in retrieve, it does this:
else if( refTypeId & asTYPEID_MASK_OBJECT )
{
// Is the object type compatible with the stored value?
// Copy the object into the given reference
if( value.typeId == refTypeId )
{
engine->AssignScriptObject(ref, value.valueObj, value.typeId);
return true;
}
}
So, isn't cScriptAny leaking the middleman object that was created within the cScriptAny class by calling CreateScriptObjectCopy?
Why is the class not freeing that copy? shouldn't there be a call to ReleaseScriptObject after calling AssignScriptObject?
I'm quite sure I'm missing something, but I'm not sure what :D
Thanks!
~Bollu