aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base/plugins.cpp2
-rw-r--r--common/config-manager.cpp2
-rw-r--r--common/singleton.h13
-rw-r--r--graphics/cursorman.cpp2
-rw-r--r--graphics/fontman.cpp2
-rw-r--r--graphics/imageman.cpp3
-rw-r--r--gui/newgui.cpp2
-rw-r--r--sound/audiocd.cpp2
8 files changed, 4 insertions, 24 deletions
diff --git a/base/plugins.cpp b/base/plugins.cpp
index 23889242f2..7e614dd2bd 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -139,8 +139,6 @@ public:
#pragma mark -
-DECLARE_SINGLETON(PluginManager);
-
PluginManager::PluginManager() {
#ifndef DYNAMIC_MODULES
// Add the static plugin provider if we do not build with dynamic
diff --git a/common/config-manager.cpp b/common/config-manager.cpp
index f8426f18d0..41f3c1a7e9 100644
--- a/common/config-manager.cpp
+++ b/common/config-manager.cpp
@@ -33,8 +33,6 @@
#include "common/file.h"
#include "common/util.h"
-DECLARE_SINGLETON(Common::ConfigManager);
-
#ifdef __PLAYSTATION2__
#include "backends/platform/ps2/systemps2.h"
#endif
diff --git a/common/singleton.h b/common/singleton.h
index 5e72e72230..f26324999e 100644
--- a/common/singleton.h
+++ b/common/singleton.h
@@ -37,8 +37,6 @@ private:
Singleton<T>(const Singleton<T>&);
Singleton<T>& operator= (const Singleton<T>&);
- static T* _singleton;
-
/**
* The default object factory used by the template class Singleton.
* By specialising this template function, one can make a singleton use a
@@ -58,16 +56,13 @@ public:
public:
static T& instance() {
- // TODO: We aren't thread safe. For now we ignore it since the
- // only thing using this singleton template is the config manager,
- // and that is first instantiated long before any threads.
+ // TODO: We aren't thread safe.
// TODO: We don't leak, but the destruction order is nevertheless
// semi-random. If we use multiple singletons, the destruction
// order might become an issue. There are various approaches
// to solve that problem, but for now this is sufficient
- if (!_singleton)
- _singleton = T::makeInstance();
- return *_singleton;
+ static T *instance = T::makeInstance();
+ return *instance;
}
protected:
Singleton<T>() { }
@@ -80,8 +75,6 @@ protected:
typedef T SingletonBaseType;
};
-#define DECLARE_SINGLETON(T) template<> T* Common::Singleton<T>::_singleton=0
-
} // End of namespace Common
#endif
diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp
index 06364b860a..397d74789f 100644
--- a/graphics/cursorman.cpp
+++ b/graphics/cursorman.cpp
@@ -24,8 +24,6 @@
#include "common/system.h"
#include "common/stack.h"
-DECLARE_SINGLETON(Graphics::CursorManager);
-
namespace Graphics {
static bool g_initialized = false;
diff --git a/graphics/fontman.cpp b/graphics/fontman.cpp
index 9b567c0be8..fad8654d02 100644
--- a/graphics/fontman.cpp
+++ b/graphics/fontman.cpp
@@ -22,8 +22,6 @@
#include "graphics/fontman.h"
//#include "gui/consolefont.h"
-DECLARE_SINGLETON(Graphics::FontManager);
-
namespace Graphics {
#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
diff --git a/graphics/imageman.cpp b/graphics/imageman.cpp
index d4fc9da72d..98c5310ffb 100644
--- a/graphics/imageman.cpp
+++ b/graphics/imageman.cpp
@@ -23,14 +23,13 @@
#include "graphics/imageman.h"
#include "graphics/surface.h"
-DECLARE_SINGLETON(Graphics::ImageManager);
-
namespace Graphics {
ImageManager::ImageManager() : _surfaces()
#ifdef USE_ZLIB
, _archives()
#endif
{
+ debug("foo");
}
ImageManager::~ImageManager() {
diff --git a/gui/newgui.cpp b/gui/newgui.cpp
index 948c7fa56f..bd7315add5 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -32,8 +32,6 @@
#include "common/config-manager.h"
-DECLARE_SINGLETON(GUI::NewGui);
-
namespace GUI {
/*
diff --git a/sound/audiocd.cpp b/sound/audiocd.cpp
index 7e1fb2400f..2635c2a0a6 100644
--- a/sound/audiocd.cpp
+++ b/sound/audiocd.cpp
@@ -32,8 +32,6 @@
#include "common/util.h"
#include "common/system.h"
-DECLARE_SINGLETON(Audio::AudioCDManager);
-
namespace Audio {
AudioCDManager::AudioCDManager() {