From be5390833be676363630fcf69e81c838ba52bac2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 3 Oct 2012 21:06:10 +0300 Subject: Partial fix for working without resource caching. --- src/resources/resourcemanager.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/resources') diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index ba23e4ac2..f67bbf71b 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -492,7 +492,6 @@ Resource *ResourceManager::get(const std::string &idPath, const generator fun, Resource *resource = getFromCache(idPath); if (resource) return resource; - resource = fun(data); if (resource) @@ -509,7 +508,12 @@ Resource *ResourceManager::get(const std::string &idPath, const generator fun, #else Resource *resource = fun(data); - if (!resource) + if (resource) + { + resource->incRef(); + resource->mIdPath = idPath; + } + else { logger->log("Error loaging image: " + idPath); } @@ -768,10 +772,10 @@ SpriteDef *ResourceManager::getSprite(const std::string &path, void ResourceManager::release(Resource *const res) { -#ifndef DISABLE_RESOURCE_CACHING if (!res || mDestruction) return; +#ifndef DISABLE_RESOURCE_CACHING std::set::iterator resDelIter = mDeletedResources.find(res); if (resDelIter != mDeletedResources.end()) { -- cgit v1.2.3-70-g09d2