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

Method DestroyInternal

sdk/angelscript/source/as_objecttype.cpp:88–149  ·  view source on GitHub ↗

internal

Source from the content-addressed store, hash-verified

86
87// internal
88void asCObjectType::DestroyInternal()
89{
90 if( engine == 0 ) return;
91
92 // Skip this for list patterns as they do not increase the references
93 if( flags & asOBJ_LIST_PATTERN )
94 {
95 // Clear the engine pointer to mark the object type as invalid
96 engine = 0;
97 return;
98 }
99
100 // Release the object types held by the templateSubTypes
101 bool isTemplateInstance = templateSubTypes.GetLength() > 0;
102 for( asUINT subtypeIndex = 0; subtypeIndex < templateSubTypes.GetLength(); subtypeIndex++ )
103 {
104 if( templateSubTypes[subtypeIndex].GetTypeInfo() )
105 templateSubTypes[subtypeIndex].GetTypeInfo()->ReleaseInternal();
106 }
107 templateSubTypes.SetLength(0);
108
109 // Clear the child types
110 for (asUINT n = 0; n < childFuncDefs.GetLength(); n++)
111 {
112 asCFuncdefType *func = childFuncDefs[n];
113 if (func)
114 {
115 func->parentClass = 0;
116 if (isTemplateInstance)
117 {
118 // Any child funcdefs that have been created as part of the template
119 // instantiation must be destroyed too
120 // TODO: Before destroying the funcdef, make sure no external references to it is held
121 if (func->externalRefCount.get() == 0)
122 {
123 func->DestroyInternal();
124 engine->RemoveFuncdef(func);
125 func->module = 0;
126 func->ReleaseInternal();
127 }
128 }
129 }
130 }
131 childFuncDefs.SetLength(0);
132
133 if( derivedFrom )
134 derivedFrom->ReleaseInternal();
135 derivedFrom = 0;
136
137 ReleaseAllProperties();
138
139 ReleaseAllFunctions();
140
141 CleanUserData();
142
143 // Remove the type from the engine
144 if( typeId != -1 )
145 engine->RemoveFromTypeIdMap(this);

Callers

nothing calls this directly

Calls 7

GetTypeInfoMethod · 0.80
RemoveFuncdefMethod · 0.80
RemoveFromTypeIdMapMethod · 0.80
GetLengthMethod · 0.45
ReleaseInternalMethod · 0.45
SetLengthMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected