MCPcopy Create free account
hub / github.com/anjo76/angelscript / ~asCScriptEngine

Method ~asCScriptEngine

sdk/angelscript/source/as_scriptengine.cpp:812–975  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

810}
811
812asCScriptEngine::~asCScriptEngine()
813{
814 // TODO: clean-up: Clean up redundant code
815
816 inDestructor = true;
817
818 asASSERT(refCount.get() == 0);
819
820 // If ShutDown hasn't been called yet do it now
821 if( !shuttingDown )
822 {
823 AddRef();
824 ShutDownAndRelease();
825 }
826
827 // Unravel the registered interface
828 if( defaultArrayObjectType )
829 {
830 defaultArrayObjectType->ReleaseInternal();
831 defaultArrayObjectType = 0;
832 }
833
834 // Delete the functions for generated template types that may references object types
835 for( asUINT n = 0; n < generatedTemplateTypes.GetLength(); n++ )
836 {
837 asCObjectType *templateType = generatedTemplateTypes[n];
838 if( templateType )
839 templateType->DestroyInternal();
840 }
841 for( asUINT n = 0; n < listPatternTypes.GetLength(); n++ )
842 {
843 asCObjectType *type = listPatternTypes[n];
844 if( type )
845 type->ReleaseInternal();
846 }
847 listPatternTypes.SetLength(0);
848
849 // No script types must have survived
850 asASSERT( sharedScriptTypes.GetLength() == 0 );
851
852 // It is allowed to create new references to the engine temporarily while destroying objects
853 // but these references must be release immediately or else something is can go wrong later on
854 if( refCount.get() > 0 )
855 WriteMessage("", 0, 0, asMSGTYPE_ERROR, TXT_ENGINE_REF_COUNT_ERROR_DURING_SHUTDOWN);
856
857 mapTypeIdToTypeInfo.EraseAll();
858
859 // First remove what is not used, so that other groups can be deleted safely
860 defaultGroup.RemoveConfiguration(this, true);
861 while( configGroups.GetLength() )
862 {
863 // Delete config groups in the right order
864 asCConfigGroup *grp = configGroups.PopLast();
865 if( grp )
866 {
867 grp->RemoveConfiguration(this);
868 asDELETE(grp,asCConfigGroup);
869 }

Callers

nothing calls this directly

Calls 14

EraseAllMethod · 0.80
RemoveConfigurationMethod · 0.80
PopLastMethod · 0.80
ListMethod · 0.80
ReleaseAllFunctionsMethod · 0.80
AddRefFunction · 0.50
getMethod · 0.45
ReleaseInternalMethod · 0.45
GetLengthMethod · 0.45
DestroyInternalMethod · 0.45
SetLengthMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected