diff --git a/PowerEditor/src/EncodingMapper.h b/PowerEditor/src/EncodingMapper.h index 897162bf9..ee3cf2d78 100644 --- a/PowerEditor/src/EncodingMapper.h +++ b/PowerEditor/src/EncodingMapper.h @@ -36,8 +36,8 @@ struct EncodingUnit { class EncodingMapper { public: static EncodingMapper * getInstance() { - static EncodingMapper _pSelf; - return &_pSelf; + static EncodingMapper instance; + return &instance; }; int getEncodingFromIndex(int index) const; int getIndexFromEncoding(int encoding) const; diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 591c11d87..869395f95 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -827,10 +827,6 @@ winVer NppParameters::getWindowsVersion() return WV_UNKNOWN; } - - -NppParameters * NppParameters::_pSelf = new NppParameters; - int FileDialog::_dialogFileBoxId = (NppParameters::getInstance())->getWinVersion() < WV_W2K?edt1:cmb13; @@ -1439,8 +1435,6 @@ void NppParameters::destroyInstance() delete _pXmlContextMenuDocA; delete _pXmlSessionDoc; delete _pXmlBlacklistDoc; - delete _pSelf; - _pSelf = nullptr; } @@ -3755,7 +3749,7 @@ LangType NppParameters::getLangIDFromStr(const TCHAR *langName) LangType l = (LangType)lang; if (l == L_EXTERNAL) //try find external lexer { - int id = _pSelf->getExternalLangIndexFromName(langName); + int id = NppParameters::getInstance()->getExternalLangIndexFromName(langName); if (id != -1) return (LangType)(id + L_EXTERNAL); } diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 62832a08a..708e28717 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -1290,7 +1290,10 @@ const int RECENTFILES_SHOWONLYFILENAME = 0; class NppParameters final { public: - static NppParameters * getInstance() {return _pSelf;}; + static NppParameters* getInstance() { + static NppParameters instance; + return &instance; + }; static LangType getLangIDFromStr(const TCHAR *langName); static generic_string getLocPathFromStr(const generic_string & localizationCode); @@ -1645,8 +1648,6 @@ private: NppParameters(); ~NppParameters(); - static NppParameters *_pSelf; - TiXmlDocument *_pXmlDoc = nullptr; TiXmlDocument *_pXmlUserDoc = nullptr; TiXmlDocument *_pXmlUserStylerDoc = nullptr;