MCPcopy Create free account
hub / github.com/anjo76/angelscript / ReleaseScriptObject

Method ReleaseScriptObject

sdk/angelscript/source/as_scriptengine.cpp:5737–5774  ·  view source on GitHub ↗

interface

Source from the content-addressed store, hash-verified

5735
5736// interface
5737void asCScriptEngine::ReleaseScriptObject(void *obj, const asITypeInfo *type)
5738{
5739 // Make sure it is not a null pointer
5740 if( obj == 0 || type == 0 ) return;
5741
5742 const asCTypeInfo *ti = reinterpret_cast<const asCTypeInfo*>(type);
5743 if (ti->flags & asOBJ_FUNCDEF)
5744 {
5745 CallObjectMethod(obj, functionBehaviours.beh.release);
5746 }
5747 else
5748 {
5749 asCObjectType *objType = CastToObjectType(const_cast<asCTypeInfo*>(ti));
5750 if (objType && objType->flags & asOBJ_REF)
5751 {
5752 asASSERT((objType->flags & asOBJ_NOCOUNT) || objType->beh.release);
5753 if (objType->beh.release)
5754 {
5755 // Call the release behaviour
5756 CallObjectMethod(obj, objType->beh.release);
5757 }
5758 }
5759 else if( objType )
5760 {
5761 // Call the destructor
5762 if (objType->beh.destruct)
5763 CallObjectMethod(obj, objType->beh.destruct);
5764 else if (objType->flags & asOBJ_LIST_PATTERN)
5765 DestroyList((asBYTE*)obj, objType);
5766
5767 // We'll have to trust that the memory for the object was allocated with CallAlloc.
5768 // This is true if the object was created in the context, or with CreateScriptObject.
5769
5770 // Then free the memory
5771 CallFree(obj);
5772 }
5773 }
5774}
5775
5776// interface
5777int asCScriptEngine::BeginConfigGroup(const char *groupName)

Callers 15

ReleaseReferencesMethod · 0.80
ReleaseAllHandlesMethod · 0.80
FreeValueMethod · 0.80
SetValueMethod · 0.80
DestructMethod · 0.80
CopyBufferMethod · 0.80
ClearChildrenMethod · 0.80
RestoreHandlesMethod · 0.80
weakref.cppFile · 0.80
ReleaseHandleMethod · 0.80
FreeObjectMethod · 0.80
SetValueMethod · 0.80

Calls 1

CastToObjectTypeFunction · 0.85

Tested by 5

ClearMethod · 0.64
ReleaseHandleMethod · 0.64
TestFunction · 0.64
SetCBFunction · 0.64
TestFunction · 0.64