From 4636bb69073714037a40a59a88c762677f6fe69d Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 10 Oct 2019 08:22:19 +0200 Subject: [PATCH] Debugger: Prevent crash on shutdown It may happen that the global log window gets destroyed before the log windows of a running engine when QC is closed after an unsuccessful attempt to debug. Avoid accessing it when trying to write output that has not been processed so far. Change-Id: I41296cc37bab1e4f1272b05dda1979d813981aa7 Reviewed-by: Christian Stenger Reviewed-by: David Schulz --- src/plugins/debugger/logwindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/debugger/logwindow.cpp b/src/plugins/debugger/logwindow.cpp index 1c5d9fd487a..e6d48d3cd99 100644 --- a/src/plugins/debugger/logwindow.cpp +++ b/src/plugins/debugger/logwindow.cpp @@ -567,7 +567,8 @@ void LogWindow::doOutput() if (m_queuedOutput.isEmpty()) return; - theGlobalLog->doOutput(m_queuedOutput); + if (theGlobalLog) + theGlobalLog->doOutput(m_queuedOutput); QTextCursor cursor = m_combinedText->textCursor(); const bool atEnd = cursor.atEnd(); @@ -706,6 +707,7 @@ GlobalLogWindow::GlobalLogWindow() GlobalLogWindow::~GlobalLogWindow() { + theGlobalLog = nullptr; } void GlobalLogWindow::doOutput(const QString &output)