diff --git a/core/base/src/TErrorDefaultHandler.cxx b/core/base/src/TErrorDefaultHandler.cxx index bd82de118521a..8f82befaabc23 100644 --- a/core/base/src/TErrorDefaultHandler.cxx +++ b/core/base/src/TErrorDefaultHandler.cxx @@ -101,12 +101,14 @@ static void DebugPrint(const char *fmt, ...) void DefaultErrorHandler(Int_t level, Bool_t abort_bool, const char *location, const char *msg) { if (gErrorIgnoreLevel == kUnset) { + // This can also print error messages, so we need to do it outside the lock + auto cstrlevel = gEnv->GetValue("Root.ErrorIgnoreLevel", "Print"); + std::lock_guard guard(*GetErrorMutex()); gErrorIgnoreLevel = 0; if (gEnv) { std::string slevel; - auto cstrlevel = gEnv->GetValue("Root.ErrorIgnoreLevel", "Print"); while (cstrlevel && *cstrlevel) { slevel.push_back(tolower(*cstrlevel)); cstrlevel++;