From d10d5deee3f67c93e8d6d2a4db437e2b6cf9ecd4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 28 Sep 2012 20:56:26 +0300 Subject: Change deleted resource list from map to vector. --- src/resources/resourcemanager.cpp | 14 +++++++------- src/resources/resourcemanager.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index f398c4b45..9c9bb3b32 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -67,7 +67,7 @@ ResourceManager::~ResourceManager() { mDestruction = true; mResources.insert(mOrphanedResources.begin(), mOrphanedResources.end()); - mResources.insert(mDeletedResources.begin(), mDeletedResources.end()); +// mResources.insert(mDeletedResources.begin(), mDeletedResources.end()); // Release any remaining spritedefs first because they depend on image sets ResourceIterator iter = mResources.begin(); @@ -673,16 +673,16 @@ void ResourceManager::release(Resource *const res) if (!res || mDestruction) return; - ResourceIterator resIter = mDeletedResources.find(res->mIdPath); - if (resIter != mDeletedResources.end() && resIter->second == res) + std::set::iterator resDelIter = mDeletedResources.find(res); + if (resDelIter != mDeletedResources.end()) { // we found zero counted image in deleted list. deleting it and exit. - mDeletedResources.erase(resIter); + mDeletedResources.erase(resDelIter); delete res; return; } - resIter = mResources.find(res->mIdPath); + ResourceIterator resIter = mResources.find(res->mIdPath); // The resource has to exist assert(resIter != mResources.end() && resIter->second == res); @@ -707,13 +707,13 @@ void ResourceManager::moveToDeleted(Resource *const res) ResourceIterator resIter = mResources.find(res->mIdPath); if (resIter != mResources.end() && resIter->second == res) { - mDeletedResources.insert(*resIter); + mDeletedResources.insert(res); mResources.erase(resIter); } resIter = mOrphanedResources.find(res->mIdPath); if (resIter != mOrphanedResources.end() && resIter->second == res) { - mDeletedResources.insert(*resIter); + mDeletedResources.insert(res); mOrphanedResources.erase(resIter); } } diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h index 2c9fbe3eb..e20e4b3ac 100644 --- a/src/resources/resourcemanager.h +++ b/src/resources/resourcemanager.h @@ -312,7 +312,7 @@ class ResourceManager final std::set deletedSurfaces; Resources mResources; Resources mOrphanedResources; - Resources mDeletedResources; + std::set mDeletedResources; time_t mOldestOrphan; std::string mSelectedSkin; std::string mSkinName; -- cgit v1.2.3-70-g09d2