1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Fix memory leaks in launcher.

This commit is contained in:
Karlis Senko
2018-04-28 11:56:01 +03:00
parent 7fb7ceaad7
commit 40e6292ed2
6 changed files with 12 additions and 19 deletions

View File

@@ -22,6 +22,7 @@
#include "../CStopWatch.h"
std::map<std::string, ISimpleResourceLoader*> CResourceHandler::knownLoaders = std::map<std::string, ISimpleResourceLoader*>();
CResourceHandler CResourceHandler::globalResourceHandler;
CFilesystemGenerator::CFilesystemGenerator(std::string prefix):
filesystem(new CFilesystemList()),
@@ -117,11 +118,6 @@ void CFilesystemGenerator::loadJsonMap(const std::string &mountPoint, const Json
}
}
void CResourceHandler::clear()
{
delete knownLoaders["root"];
}
ISimpleResourceLoader * CResourceHandler::createInitial()
{
//temporary filesystem that will be used to initialize main one.
@@ -174,7 +170,8 @@ void CResourceHandler::initialize()
// |-saves
// |-config
knownLoaders["root"] = new CFilesystemList();
globalResourceHandler.rootLoader = vstd::make_unique<CFilesystemList>();
knownLoaders["root"] = globalResourceHandler.rootLoader.get();
knownLoaders["saves"] = new CFilesystemLoader("SAVES/", VCMIDirs::get().userSavePath());
knownLoaders["config"] = new CFilesystemLoader("CONFIG/", VCMIDirs::get().userConfigPath());