diff options
Diffstat (limited to 'src/resources/resourcemanager.cpp')
-rw-r--r-- | src/resources/resourcemanager.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index b6befb491..ba23e4ac2 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -258,7 +258,7 @@ void ResourceManager::logResource(const Resource *const res) #endif } -void ResourceManager::clearDeleted() +void ResourceManager::clearDeleted(bool full) { bool status(true); logger->log("clear deleted"); @@ -280,7 +280,7 @@ void ResourceManager::clearDeleted() ++ resDelIter; } } - if (!mDeletedResources.empty()) + if (full && !mDeletedResources.empty()) { logger->log("leaks in deleted"); std::set<Resource*>::iterator resDelIter = mDeletedResources.begin(); @@ -783,8 +783,21 @@ void ResourceManager::release(Resource *const res) ResourceIterator resIter = mResources.find(res->mIdPath); + if (resIter == mResources.end()) + { + logger->log("no resource in cache: " + res->mIdPath); + delete res; + return; + } + if (resIter->second != res) + { + logger->log("in cache other image: " + res->mIdPath); + delete res; + return; + } + // The resource has to exist - assert(resIter != mResources.end() && resIter->second == res); +// assert(resIter != mResources.end() && resIter->second == res); timeval tv; gettimeofday(&tv, nullptr); |