From: Mikko Rasa Date: Sat, 30 Aug 2014 22:37:36 +0000 (+0300) Subject: Dissolve the association to resources when ResourceManager is destroyed X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=20703b6d4dfd0836cdb787bd416d4ae9bf010602;p=libs%2Fgl.git Dissolve the association to resources when ResourceManager is destroyed --- diff --git a/source/resourcemanager.cpp b/source/resourcemanager.cpp index 81aea8c1..98a49744 100644 --- a/source/resourcemanager.cpp +++ b/source/resourcemanager.cpp @@ -15,6 +15,9 @@ ResourceManager::ResourceManager(): ResourceManager::~ResourceManager() { thread.terminate(); + + for(ResourceMap::iterator i=resources.begin(); i!=resources.end(); ++i) + i->second.resource->set_manager(0); } void ResourceManager::add_resource(Resource &r) diff --git a/source/resourcemanager.h b/source/resourcemanager.h index fb435335..49a4c0bd 100644 --- a/source/resourcemanager.h +++ b/source/resourcemanager.h @@ -65,12 +65,13 @@ private: void terminate(); }; + typedef std::map ResourceMap; typedef std::list LoadQueue; LoadingPolicy policy; bool async_loads; - std::map resources; - std::list queue; + ResourceMap resources; + LoadQueue queue; LoadingThread thread; public: