diff options
author | maksymsproductengine <maksymsproductengine@lindenlab.com> | 2014-02-05 20:45:09 +0200 |
---|---|---|
committer | maksymsproductengine <maksymsproductengine@lindenlab.com> | 2014-02-05 20:45:09 +0200 |
commit | 1033c9d67f6bf3fd317bc2e6a6990e2b7e5d80c8 (patch) | |
tree | 21b7fe3491804d6acd521bb3cdc6c1ec65a1ee44 /indra/llcommon | |
parent | 52ce788d0cf77361dc337edaf136f401acd0d4a9 (diff) |
MAINT-3555 crash in LLPanel::~LLPanel() on shutdown:
- memory leaks fixing;
Diffstat (limited to 'indra/llcommon')
-rwxr-xr-x | indra/llcommon/llerror.cpp | 68 |
1 files changed, 38 insertions, 30 deletions
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 853f279c95..925fca1b4b 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -207,6 +207,10 @@ namespace { #endif } +namespace LLError +{ + void clean(); +} namespace { @@ -352,7 +356,11 @@ namespace Globals() : messageStreamInUse(false) { } - + + ~Globals() + { + LLError::clean(); + } }; void Globals::addCallSite(LLError::CallSite& site) @@ -380,8 +388,9 @@ namespace is. See C++ FAQ Lite, sections 10.12 through 10.14 */ - static Globals* globals = new Globals; - return *globals; + + static Globals globals; + return globals; } } @@ -415,6 +424,7 @@ namespace LLError static void reset(); static Settings* saveAndReset(); static void restore(Settings*); + static void clean(); private: Settings() @@ -446,6 +456,15 @@ namespace LLError } return *p; } + + void Settings::clean() + { + Globals::get().invalidateCallSites(); + + Settings*& p = getPtr(); + delete p; + p = NULL; + } void Settings::reset() { @@ -480,10 +499,7 @@ namespace LLError static Settings* currentSettings = NULL; return currentSettings; } -} -namespace LLError -{ CallSite::CallSite(ELevel level, const char* file, int line, @@ -721,11 +737,7 @@ namespace LLError setLevels(s.tagLevelMap, entry["tags"], level); } } -} - -namespace LLError -{ Recorder::~Recorder() { } @@ -756,18 +768,26 @@ namespace LLError std::remove(s.recorders.begin(), s.recorders.end(), recorder), s.recorders.end()); } -} -namespace LLError -{ + void deleteRecorder(LLError::Settings& settings) + { + removeRecorder(settings.fileRecorder); + delete settings.fileRecorder; + settings.fileRecorder = NULL; + settings.fileRecorderFileName.clear(); + } + + void clean() + { + deleteRecorder(LLError::Settings::get()); + LLError::Settings::clean(); + } + void logToFile(const std::string& file_name) { LLError::Settings& s = LLError::Settings::get(); - removeRecorder(s.fileRecorder); - delete s.fileRecorder; - s.fileRecorder = NULL; - s.fileRecorderFileName.clear(); + deleteRecorder(s); if (file_name.empty()) { @@ -839,8 +859,6 @@ namespace } } } -} - /* Recorder formats: @@ -870,7 +888,6 @@ You get: */ -namespace { bool checkLevelMap(const LevelMap& map, const std::string& key, LLError::ELevel& level) { @@ -1127,13 +1144,7 @@ namespace LLError s.crashFunction(message); } } -} - - - -namespace LLError -{ Settings* saveAndResetSettings() { return Settings::saveAndReset(); @@ -1226,10 +1237,7 @@ namespace LLError return chars ? time_str : "time error"; } -} - -namespace LLError -{ + char** LLCallStacks::sBuffer = NULL ; S32 LLCallStacks::sIndex = 0 ; |