diff options
-rw-r--r-- | src/animatedsprite.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp index 573c2ebc5..41a7aa215 100644 --- a/src/animatedsprite.cpp +++ b/src/animatedsprite.cpp @@ -77,8 +77,12 @@ AnimatedSprite *AnimatedSprite::delayedLoad(const std::string &filename, if (!mEnableCache) return load(filename, variant); ResourceManager *resman = ResourceManager::getInstance(); - if (resman->getFromCache(filename, variant)) + Resource *res = resman->getFromCache(filename, variant); + if (res) + { + res->decRef(); return load(filename, variant); + } AnimatedSprite *as = new AnimatedSprite(nullptr); as->setDelayLoad(filename, variant); |