summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2019-10-10 08:22:19 +0200
committerChristian Stenger <christian.stenger@qt.io>2019-10-10 11:03:45 +0000
commit4636bb69073714037a40a59a88c762677f6fe69d (patch)
tree9259d95db59487912a21d2f03f224c1cd79cf88c
parent26cb6994c46af7b9c386f52b2485684b4dea29b7 (diff)
downloadqt-creator-4636bb69073714037a40a59a88c762677f6fe69d.tar.gz
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 <christian.stenger@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
-rw-r--r--src/plugins/debugger/logwindow.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/debugger/logwindow.cpp b/src/plugins/debugger/logwindow.cpp
index 1c5d9fd487..e6d48d3cd9 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)