diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-05-27 01:04:35 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-05-27 01:04:35 +0300 |
commit | b69e0973599907a9b1021c6859cb1d668fe9debb (patch) | |
tree | c6c18a238388fa65aa8b4ddd6eaf1ca5a9f0449e /src/resources/resourcemanager.cpp | |
parent | 98b4c6c5b5eb7c60919108c130d534938aed853e (diff) | |
download | mv-b69e0973599907a9b1021c6859cb1d668fe9debb.tar.gz mv-b69e0973599907a9b1021c6859cb1d668fe9debb.tar.bz2 mv-b69e0973599907a9b1021c6859cb1d668fe9debb.tar.xz mv-b69e0973599907a9b1021c6859cb1d668fe9debb.zip |
Fix memory leak in resourcemanager.
Diffstat (limited to 'src/resources/resourcemanager.cpp')
-rw-r--r-- | src/resources/resourcemanager.cpp | 10 |
1 files changed, 6 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); |