From 5b127dd088b93f1ec8fc88966e015aaf40f6a4b4 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 8 Oct 2019 06:38:27 +0200 Subject: Debugger: Fix out of memory crash when receiving regular output Change-Id: Icda28ec56c191e62812a4e5219a1df902c5e60a1 Fixes: QTCREATORBUG-22733 Reviewed-by: Christian Stenger --- src/plugins/debugger/logwindow.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/debugger/logwindow.cpp b/src/plugins/debugger/logwindow.cpp index e671709161..1c5d9fd487 100644 --- a/src/plugins/debugger/logwindow.cpp +++ b/src/plugins/debugger/logwindow.cpp @@ -552,8 +552,14 @@ void LogWindow::showOutput(int channel, const QString &output) out.append(nchar); m_queuedOutput.append(out); - m_outputTimer.setSingleShot(true); - m_outputTimer.start(80); + // flush the output if it exceeds 16k to prevent out of memory exceptions on regular output + if (m_queuedOutput.size() > 16 * 1024) { + m_outputTimer.stop(); + doOutput(); + } else { + m_outputTimer.setSingleShot(true); + m_outputTimer.start(80); + } } void LogWindow::doOutput() -- cgit v1.2.1