easylogging++: fix crash with reentrant logging
This commit is contained in:
parent
6dd95d5308
commit
92e6b7df2c
11
external/easylogging++/easylogging++.cc
vendored
11
external/easylogging++/easylogging++.cc
vendored
@ -2968,6 +2968,16 @@ void Writer::initializeLogger(Logger *logger, bool needLock) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Writer::processDispatch() {
|
void Writer::processDispatch() {
|
||||||
|
static std::atomic_flag in_dispatch;
|
||||||
|
if (in_dispatch.test_and_set())
|
||||||
|
{
|
||||||
|
if (m_proceed && m_logger != NULL)
|
||||||
|
{
|
||||||
|
m_logger->stream().str(ELPP_LITERAL(""));
|
||||||
|
m_logger->releaseLock();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
#if ELPP_LOGGING_ENABLED
|
#if ELPP_LOGGING_ENABLED
|
||||||
if (ELPP->hasFlag(LoggingFlag::MultiLoggerSupport)) {
|
if (ELPP->hasFlag(LoggingFlag::MultiLoggerSupport)) {
|
||||||
bool firstDispatched = false;
|
bool firstDispatched = false;
|
||||||
@ -3006,6 +3016,7 @@ void Writer::processDispatch() {
|
|||||||
m_logger->releaseLock();
|
m_logger->releaseLock();
|
||||||
}
|
}
|
||||||
#endif // ELPP_LOGGING_ENABLED
|
#endif // ELPP_LOGGING_ENABLED
|
||||||
|
in_dispatch.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Writer::triggerDispatch(void) {
|
void Writer::triggerDispatch(void) {
|
||||||
|
Loading…
Reference in New Issue
Block a user