summaryrefslogtreecommitdiff
path: root/src/resources/resourcemanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-22 01:55:26 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-22 01:55:26 +0300
commitec856b2026c7ceecab5f74942bb36661d7c6ae67 (patch)
tree43d52203d73144c184c648c8cc3badd723347079 /src/resources/resourcemanager.cpp
parentfb0dad2c1b014efe72f67a9da149083aee703f92 (diff)
downloadmv-ec856b2026c7ceecab5f74942bb36661d7c6ae67.tar.gz
mv-ec856b2026c7ceecab5f74942bb36661d7c6ae67.tar.bz2
mv-ec856b2026c7ceecab5f74942bb36661d7c6ae67.tar.xz
mv-ec856b2026c7ceecab5f74942bb36661d7c6ae67.zip
Add init to resource manager.
Diffstat (limited to 'src/resources/resourcemanager.cpp')
-rw-r--r--src/resources/resourcemanager.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index bec7914fc..50d6ccb6d 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -58,6 +58,7 @@
#include "debug.h"
+ResourceManager *resourceManager = nullptr;
ResourceManager *ResourceManager::instance = nullptr;
ResourceManager::ResourceManager() :
@@ -171,6 +172,12 @@ ResourceManager::~ResourceManager()
clearScheduled();
}
+void ResourceManager::init()
+{
+ if (!resourceManager)
+ resourceManager = new ResourceManager;
+}
+
void ResourceManager::cleanUp(Resource *const res)
{
if (!res)
@@ -949,10 +956,7 @@ void ResourceManager::decRefDelete(Resource *const res)
ResourceManager *ResourceManager::getInstance()
{
- // Create a new instance if necessary.
- if (!instance)
- instance = new ResourceManager;
- return instance;
+ return resourceManager;
}
void ResourceManager::deleteInstance()