diff options
author | Maarten Vanraes <maarten.vanraes@gmail.com> | 2011-05-27 00:55:51 +0200 |
---|---|---|
committer | Maarten Vanraes <maarten.vanraes@gmail.com> | 2011-05-27 00:55:51 +0200 |
commit | a63ffa0b1f1db7401d79e08bb32ba911ee8b7d35 (patch) | |
tree | 948bb6a85f090527bdb2387f65234749fe2f0b50 | |
parent | 1d7cb39aadecc370b4bca1c3e0162a9763ff611a (diff) | |
parent | d4beb6fec5eefa60a2d2f873feabaf84731bd50b (diff) | |
download | plus-a63ffa0b1f1db7401d79e08bb32ba911ee8b7d35.tar.gz plus-a63ffa0b1f1db7401d79e08bb32ba911ee8b7d35.tar.bz2 plus-a63ffa0b1f1db7401d79e08bb32ba911ee8b7d35.tar.xz plus-a63ffa0b1f1db7401d79e08bb32ba911ee8b7d35.zip |
Merge branch 'master' of git://gitorious.org/manaplus/manaplus
-rw-r--r-- | src/graphicsvertexes.cpp | 2 | ||||
-rw-r--r-- | src/resources/resourcemanager.cpp | 10 | ||||
-rw-r--r-- | src/resources/resourcemanager.h | 1 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/graphicsvertexes.cpp b/src/graphicsvertexes.cpp index 0cadfedc2..d5b374db9 100644 --- a/src/graphicsvertexes.cpp +++ b/src/graphicsvertexes.cpp @@ -132,6 +132,7 @@ void GraphicsVertexes::init(int x, int y, int w, int h) mH = h; for (int f = 0; f < 10; f ++) { + delete_all(sdl[mPtr].mList); sdl[mPtr].mList.clear(); #ifdef USE_OPENGL ogl[mPtr].init(); @@ -156,6 +157,7 @@ void GraphicsVertexes::pushSDL(SDL_Rect r1, SDL_Rect r2) void GraphicsVertexes::clearSDL() { + delete_all(sdl[mPtr].mList); sdl[mPtr].mList.clear(); } 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 |