From 622f68412440d4fa3ac1b347a929087073bc24f9 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Thu, 18 Apr 2019 12:23:50 +0200 Subject: [PATCH] StreamLogger#BindStream(): set #m_FlushLogTimer only if needed refs #6737 --- lib/base/streamlogger.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/base/streamlogger.cpp b/lib/base/streamlogger.cpp index 0c3d797f2..146fe3c91 100644 --- a/lib/base/streamlogger.cpp +++ b/lib/base/streamlogger.cpp @@ -55,10 +55,12 @@ void StreamLogger::BindStream(std::ostream *stream, bool ownsStream) m_Stream = stream; m_OwnsStream = ownsStream; - m_FlushLogTimer = new Timer(); - m_FlushLogTimer->SetInterval(1); - m_FlushLogTimer->OnTimerExpired.connect(std::bind(&StreamLogger::FlushLogTimerHandler, this)); - m_FlushLogTimer->Start(); + if (!m_FlushLogTimer) { + m_FlushLogTimer = new Timer(); + m_FlushLogTimer->SetInterval(1); + m_FlushLogTimer->OnTimerExpired.connect(std::bind(&StreamLogger::FlushLogTimerHandler, this)); + m_FlushLogTimer->Start(); + } } /**