diff --git a/src/lib/ipc/CIpcLogOutputter.cpp b/src/lib/ipc/CIpcLogOutputter.cpp index e958772b..477d1e72 100644 --- a/src/lib/ipc/CIpcLogOutputter.cpp +++ b/src/lib/ipc/CIpcLogOutputter.cpp @@ -89,7 +89,11 @@ CIpcLogOutputter::write(ELevel, const char* text, bool force) // would be difficult to distinguish (other than looking at the stack // trace somehow). perhaps a file stream might be a better option :-/ if (m_sending && !force) { - return true; + + // ignore events from the buffer thread (would cause recursion). + if (CThread::getCurrentThread().getID() == m_bufferThreadId) { + return true; + } } appendBuffer(text); @@ -107,6 +111,7 @@ CIpcLogOutputter::appendBuffer(const CString& text) void CIpcLogOutputter::bufferThread(void*) { + m_bufferThreadId = m_bufferThread->getID(); try { while (m_running) { diff --git a/src/lib/ipc/CIpcLogOutputter.h b/src/lib/ipc/CIpcLogOutputter.h index 4db8c281..284e815b 100644 --- a/src/lib/ipc/CIpcLogOutputter.h +++ b/src/lib/ipc/CIpcLogOutputter.h @@ -20,6 +20,7 @@ #include "ILogOutputter.h" #include "CArch.h" #include +#include "IArchMultithread.h" class CIpcServer; class CEvent; @@ -64,4 +65,6 @@ private: CArchCond m_notifyCond; CArchMutex m_notifyMutex; bool m_bufferWaiting; + IArchMultithread::ThreadID + m_bufferThreadId; };