diff --git a/simgear/misc/ResourceManager.cxx b/simgear/misc/ResourceManager.cxx index 11b67846..59454dce 100644 --- a/simgear/misc/ResourceManager.cxx +++ b/simgear/misc/ResourceManager.cxx @@ -56,6 +56,15 @@ ResourceManager::~ResourceManager() std::for_each(_providers.begin(), _providers.end(), [](ResourceProvider* p) { delete p; }); } + +void ResourceManager::reset() +{ + if (static_manager) { + delete static_manager; + static_manager = nullptr; + } +} + /** * trivial provider using a fixed base path */ @@ -107,6 +116,8 @@ void ResourceManager::removeProvider(ResourceProvider* aProvider) SG_LOG(SG_GENERAL, SG_DEV_ALERT, "unknown provider doing remove"); return; } + + _providers.erase(it); } SGPath ResourceManager::findPath(const std::string& aResource, SGPath aContext) diff --git a/simgear/misc/ResourceManager.hxx b/simgear/misc/ResourceManager.hxx index a15aaf15..b957f0de 100644 --- a/simgear/misc/ResourceManager.hxx +++ b/simgear/misc/ResourceManager.hxx @@ -45,8 +45,10 @@ public: PRIORITY_HIGH = 1000 } Priority; - static ResourceManager* instance(); - + static ResourceManager* instance(); + + static void reset(); + /** * add a simple fixed resource location, to resolve against */