]> git.tdb.fi Git - libs/gl.git/commitdiff
Dissolve the association to resources when ResourceManager is destroyed
authorMikko Rasa <tdb@tdb.fi>
Sat, 30 Aug 2014 22:37:36 +0000 (01:37 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 30 Aug 2014 22:37:36 +0000 (01:37 +0300)
source/resourcemanager.cpp
source/resourcemanager.h

index 81aea8c16f9af3f006a3030f14708ed5da6894de..98a49744a702c2ecaf7db14a99c0afbf4da6158a 100644 (file)
@@ -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)
index fb4353350f4c2138a1b4a4d1d541b08bf1016f61..49a4c0bde3a7d33b1a02da359c486257a2e9b735 100644 (file)
@@ -65,12 +65,13 @@ private:
                void terminate();
        };
 
+       typedef std::map<const Resource *, ManagedResource> ResourceMap;
        typedef std::list<ManagedResource *> LoadQueue;
 
        LoadingPolicy policy;
        bool async_loads;
-       std::map<const Resource *, ManagedResource> resources;
-       std::list<ManagedResource *> queue;
+       ResourceMap resources;
+       LoadQueue queue;
        LoadingThread thread;
 
 public: