diff --git a/src/lib/ipc/IpcLogOutputter.cpp b/src/lib/ipc/IpcLogOutputter.cpp index 276e0a941c..cf0fa03c55 100644 --- a/src/lib/ipc/IpcLogOutputter.cpp +++ b/src/lib/ipc/IpcLogOutputter.cpp @@ -95,6 +95,13 @@ IpcLogOutputter::show(bool showIfEmpty) bool IpcLogOutputter::write(ELevel, const char* text) { + if (!m_ipcServer.hasClients(kIpcClientGui)) { + if (!m_buffer.empty()) { + m_buffer.clear(); + } + return true; + } + // ignore events from the buffer thread (would cause recursion). if (m_bufferThread != nullptr && Thread::getCurrentThread().getID() == m_bufferThreadId) { @@ -185,9 +192,6 @@ void IpcLogOutputter::sendBuffer() { if (m_buffer.empty() || !m_ipcServer.hasClients(kIpcClientGui)) { - if (!m_buffer.empty()) { - m_buffer.clear(); - } return; }