Fix various memory leaks on exit
This commit is contained in:
@@ -156,9 +156,9 @@ void Log::Logger::Dispose()
|
||||
WriteFloor();
|
||||
|
||||
// Close
|
||||
LogAfterInit = false;
|
||||
if (LogAfterInit)
|
||||
{
|
||||
LogAfterInit = false;
|
||||
LogFile->Close();
|
||||
Delete(LogFile);
|
||||
LogFile = nullptr;
|
||||
|
||||
@@ -182,6 +182,7 @@ WindowsFileSystemWatcher::~WindowsFileSystemWatcher()
|
||||
FileSystemWatchers::ThreadActive = false;
|
||||
QueueUserAPC(FileSystemWatchers::StopProc, FileSystemWatchers::Thread->GetHandle(), 0);
|
||||
FileSystemWatchers::Thread->Join();
|
||||
Delete(FileSystemWatchers::Thread);
|
||||
FileSystemWatchers::Thread = nullptr;
|
||||
}
|
||||
FileSystemWatchers::Locker.Unlock();
|
||||
|
||||
@@ -518,7 +518,7 @@ void Scripting::Release()
|
||||
|
||||
module->Destroy(false);
|
||||
}
|
||||
_nonNativeModules.Clear();
|
||||
_nonNativeModules.ClearDelete();
|
||||
_hasGameModulesLoaded = false;
|
||||
}
|
||||
|
||||
@@ -619,7 +619,7 @@ void Scripting::Reload(bool canTriggerSceneReload)
|
||||
module->Destroy(true);
|
||||
}
|
||||
modules.Clear();
|
||||
_nonNativeModules.Clear();
|
||||
_nonNativeModules.ClearDelete();
|
||||
_hasGameModulesLoaded = false;
|
||||
|
||||
// Give GC a try to cleanup old user objects and the other mess
|
||||
|
||||
Reference in New Issue
Block a user