internal
| 674 | |
| 675 | // internal |
| 676 | void asCModule::InternalReset() |
| 677 | { |
| 678 | CallExit(); |
| 679 | |
| 680 | asUINT n; |
| 681 | |
| 682 | // Remove all global functions |
| 683 | m_globalFunctions.Clear(); |
| 684 | |
| 685 | // Destroy the internals of the global properties here, but do not yet remove them from the |
| 686 | // engine, because functions need the engine's varAddressMap to get to the property. If the |
| 687 | // property is removed already, it may leak as the refCount doesn't reach 0. |
| 688 | asCSymbolTableIterator<asCGlobalProperty> globIt = m_scriptGlobals.List(); |
| 689 | while( globIt ) |
| 690 | { |
| 691 | (*globIt)->DestroyInternal(); |
| 692 | globIt++; |
| 693 | } |
| 694 | |
| 695 | UnbindAllImportedFunctions(); |
| 696 | |
| 697 | // Free bind information |
| 698 | for( n = 0; n < m_bindInformations.GetLength(); n++ ) |
| 699 | { |
| 700 | if( m_bindInformations[n] ) |
| 701 | { |
| 702 | m_bindInformations[n]->importedFunctionSignature->ReleaseInternal(); |
| 703 | |
| 704 | asDELETE(m_bindInformations[n], sBindInfo); |
| 705 | } |
| 706 | } |
| 707 | m_bindInformations.SetLength(0); |
| 708 | |
| 709 | // Free declared types, including classes, typedefs, and enums |
| 710 | for( n = 0; n < m_templateInstances.GetLength(); n++ ) |
| 711 | { |
| 712 | asCObjectType *type = m_templateInstances[n]; |
| 713 | if( m_engine->FindNewOwnerForSharedType(type, this) != this ) |
| 714 | { |
| 715 | // The type is owned by another module, just release our reference |
| 716 | type->ReleaseInternal(); |
| 717 | continue; |
| 718 | } |
| 719 | |
| 720 | // Orphan the template instance |
| 721 | type->module = 0; |
| 722 | |
| 723 | // No other module is holding the template type |
| 724 | m_engine->RemoveTemplateInstanceType(type); |
| 725 | type->ReleaseInternal(); |
| 726 | } |
| 727 | m_templateInstances.SetLength(0); |
| 728 | for( n = 0; n < m_classTypes.GetLength(); n++ ) |
| 729 | { |
| 730 | asCObjectType *type = m_classTypes[n]; |
| 731 | if( type->IsShared() ) |
| 732 | { |
| 733 | // The type is shared, so transfer ownership to another module that also uses it |
no test coverage detected