From f1f7426d5436bd019213fb9d086f513688ee5fe1 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Tue, 9 Jul 2024 15:36:00 -0500 Subject: #1826 Fix for LL_ERRS crashing in mutex lock --- indra/llcommon/llerror.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index a45bc32028..fa24c2eaf4 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -55,6 +55,7 @@ #include "llsingleton.h" #include "llstl.h" #include "lltimer.h" +#include // On Mac, got: // #error "Boost.Stacktrace requires `_Unwind_Backtrace` function. Define @@ -506,7 +507,7 @@ namespace LLError::TimeFunction mTimeFunction; Recorders mRecorders; - LLCoros::Mutex mRecorderMutex; + boost::fibers::recursive_mutex mRecorderMutex; int mShouldLogCallCounter; @@ -1044,7 +1045,7 @@ namespace LLError return; } SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - LLCoros::LockType lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); s->mRecorders.push_back(recorder); } @@ -1055,7 +1056,7 @@ namespace LLError return; } SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - LLCoros::LockType lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); s->mRecorders.erase(std::remove(s->mRecorders.begin(), s->mRecorders.end(), recorder), s->mRecorders.end()); } @@ -1104,7 +1105,7 @@ namespace LLError std::shared_ptr findRecorder() { SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - LLCoros::LockType lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); return findRecorderPos(s).first; } @@ -1115,7 +1116,7 @@ namespace LLError bool removeRecorder() { SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - LLCoros::LockType lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); auto found = findRecorderPos(s); if (found.first) { @@ -1221,7 +1222,7 @@ namespace std::string escaped_message; - LLCoros::LockType lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); for (LLError::RecorderPtr& r : s->mRecorders) { if (!r->enabled()) -- cgit v1.2.3 From d9782cf9660bd08b2577d79b29e93129c838de3b Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Tue, 9 Jul 2024 15:53:06 -0500 Subject: Review feedback change --- indra/llcommon/llerror.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index fa24c2eaf4..fa24987d1c 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -1045,7 +1045,7 @@ namespace LLError return; } SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - std::unique_lock lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); s->mRecorders.push_back(recorder); } @@ -1056,7 +1056,7 @@ namespace LLError return; } SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - std::unique_lock lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); s->mRecorders.erase(std::remove(s->mRecorders.begin(), s->mRecorders.end(), recorder), s->mRecorders.end()); } @@ -1105,7 +1105,7 @@ namespace LLError std::shared_ptr findRecorder() { SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - std::unique_lock lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); return findRecorderPos(s).first; } @@ -1116,7 +1116,7 @@ namespace LLError bool removeRecorder() { SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); - std::unique_lock lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); auto found = findRecorderPos(s); if (found.first) { @@ -1222,7 +1222,7 @@ namespace std::string escaped_message; - std::unique_lock lock(s->mRecorderMutex); + std::unique_lock lock(s->mRecorderMutex); for (LLError::RecorderPtr& r : s->mRecorders) { if (!r->enabled()) -- cgit v1.2.3