- do not delete the namespaces when removing compiler symbols. They still get referenced by some types and must remain until the engine shuts down.

This commit is contained in:
Christoph Oelckers 2017-04-14 19:40:50 +02:00
parent 7186342221
commit d014395dae
2 changed files with 7 additions and 5 deletions

View file

@ -267,6 +267,7 @@ void PClass::StaticShutdown ()
{
p.PendingWeapon = nullptr;
}
Namespaces.ReleaseSymbols();
// This must be done in two steps because the native classes are not ordered by inheritance,
// so all meta data must be gone before deleting the actual class objects.
@ -275,7 +276,6 @@ void PClass::StaticShutdown ()
// Unless something went wrong, anything left here should be class and type objects only, which do not own any scripts.
bShutdown = true;
TypeTable.Clear();
Namespaces.ReleaseSymbols();
ClassDataAllocator.FreeAllBlocks();
AllClasses.Clear();
PClassActor::AllActorClasses.Clear();

View file

@ -512,13 +512,16 @@ PNamespace *FNamespaceManager::NewNamespace(int filenum)
//==========================================================================
//
//
// Deallocate the entire namespace manager.
//
//==========================================================================
void FNamespaceManager::ReleaseSymbols()
{
RemoveSymbols();
for (auto ns : AllNamespaces)
{
delete ns;
}
GlobalNamespace = nullptr;
AllNamespaces.Clear();
}
@ -537,7 +540,7 @@ int FNamespaceManager::RemoveSymbols()
for (auto ns : AllNamespaces)
{
count += ns->Symbols.Symbols.CountUsed();
delete ns;
ns->Symbols.ReleaseSymbols();
}
return count;
}
@ -550,7 +553,6 @@ int FNamespaceManager::RemoveSymbols()
void RemoveUnusedSymbols()
{
// Global symbols are not needed anymore after running the compiler.
int count = Namespaces.RemoveSymbols();
// We do not need any non-field and non-function symbols in structs and classes anymore.