summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/resourcemanager.cpp10
-rw-r--r--src/resources/resourcemanager.h1
2 files changed, 7 insertions, 4 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 5552b64b1..54c7a22e4 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -47,16 +47,18 @@
ResourceManager *ResourceManager::instance = NULL;
-ResourceManager::ResourceManager()
- : mOldestOrphan(0),
+ResourceManager::ResourceManager() :
+ mOldestOrphan(0),
mSelectedSkin(""),
- mSkinName("")
+ mSkinName(""),
+ mDestruction(0)
{
logger->log1("Initializing resource manager...");
}
ResourceManager::~ResourceManager()
{
+ mDestruction = true;
mResources.insert(mOrphanedResources.begin(), mOrphanedResources.end());
// Release any remaining spritedefs first because they depend on image sets
@@ -526,7 +528,7 @@ SpriteDef *ResourceManager::getSprite(const std::string &path, int variant)
void ResourceManager::release(Resource *res)
{
- if (!res)
+ if (!res || mDestruction)
return;
ResourceIterator resIter = mResources.find(res->mIdPath);
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index 16ded5ab2..8d1070463 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -263,6 +263,7 @@ class ResourceManager
time_t mOldestOrphan;
std::string mSelectedSkin;
std::string mSkinName;
+ bool mDestruction;
};
#endif