Stop writing into and clear buffer when no GUI #4721

This commit is contained in:
Jerry (Xinyu Hou) 2015-05-29 16:55:22 -07:00
parent 9487db1672
commit 97bac70fae
1 changed files with 7 additions and 0 deletions

View File

@ -95,6 +95,13 @@ IpcLogOutputter::show(bool showIfEmpty)
bool bool
IpcLogOutputter::write(ELevel, const char* text) 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). // ignore events from the buffer thread (would cause recursion).
if (m_bufferThread != nullptr && if (m_bufferThread != nullptr &&
Thread::getCurrentThread().getID() == m_bufferThreadId) { Thread::getCurrentThread().getID() == m_bufferThreadId) {