diff --git a/Source/Core/Common/Src/LogManager.h b/Source/Core/Common/Src/LogManager.h index a0aecb583e..eb5b7edff1 100644 --- a/Source/Core/Common/Src/LogManager.h +++ b/Source/Core/Common/Src/LogManager.h @@ -117,9 +117,10 @@ private: ConsoleListener *m_consoleLog; static LogManager *m_logManager; // Singleton. Ugh. -public: LogManager(); ~LogManager(); + DISALLOW_COPY_AND_ASSIGN(LogManager); +public: static u32 GetMaxLevel() { return MAX_LOGLEVEL; } diff --git a/Source/Core/Common/Src/SysConf.cpp b/Source/Core/Common/Src/SysConf.cpp index 2836fd80fc..18a3669210 100644 --- a/Source/Core/Common/Src/SysConf.cpp +++ b/Source/Core/Common/Src/SysConf.cpp @@ -38,6 +38,8 @@ SysConf::~SysConf() if (!m_IsValid) return; + Save(); + for (size_t i = 0; i < m_Entries.size() - 1; i++) { delete [] m_Entries.at(i).data; @@ -169,5 +171,7 @@ bool SysConf::SaveToFile(const char *filename) bool SysConf::Save() { + if (!m_IsValid) + return false; return SaveToFile(m_Filename.c_str()); } diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index 5921a7f9e1..14baf13eeb 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -23,23 +23,25 @@ #include "PluginManager.h" #include "FileUtil.h" -SConfig SConfig::m_Instance; - +SConfig* SConfig::m_Instance; SConfig::SConfig() { + // Make sure we have log manager + LoadSettings(); + //Make sure we load settings + LoadSettingsHLE(); } void SConfig::Init() { - // Make sure we have log manager - m_Instance.LoadSettings(); - //Make sure we load settings - m_Instance.LoadSettingsHLE(); + m_Instance = new SConfig; } void SConfig::Shutdown() { + delete m_Instance; + m_Instance = NULL; } SConfig::~SConfig() diff --git a/Source/Core/Core/Src/ConfigManager.h b/Source/Core/Core/Src/ConfigManager.h index d320aeda60..584a8f2542 100644 --- a/Source/Core/Core/Src/ConfigManager.h +++ b/Source/Core/Core/Src/ConfigManager.h @@ -103,20 +103,22 @@ struct SConfig void LoadSettingsHLE(); // Return the permanent and somewhat globally used instance of this struct - static SConfig& GetInstance() {return(m_Instance);} + static SConfig& GetInstance() {return(*m_Instance);} static void Init(); static void Shutdown(); - private: +private: - // constructor - SConfig(); + // constructor + SConfig(); - // destructor - ~SConfig(); + // destructor + ~SConfig(); - static SConfig m_Instance; + static SConfig* m_Instance; + + DISALLOW_COPY_AND_ASSIGN(SConfig); }; #endif // endif config manager diff --git a/Source/Core/Core/Src/PluginManager.h b/Source/Core/Core/Src/PluginManager.h index b0aec88de7..38b0420908 100644 --- a/Source/Core/Core/Src/PluginManager.h +++ b/Source/Core/Core/Src/PluginManager.h @@ -86,6 +86,7 @@ private: void GetPluginInfo(CPluginInfo *&info, std::string Filename); void *LoadPlugin(const char *_rFilename); + DISALLOW_COPY_AND_ASSIGN(CPluginManager); }; diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/DSPHandler.h b/Source/Plugins/Plugin_DSP_HLE/Src/DSPHandler.h index 7af80dde15..a6d9af8665 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/DSPHandler.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/DSPHandler.h @@ -57,6 +57,7 @@ public: private: CDSPHandler(); ~CDSPHandler(); + DISALLOW_COPY_AND_ASSIGN(CDSPHandler); // singleton instance static CDSPHandler* m_pInstance;