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>
This commit is contained in:
Christian Stenger
2019-10-10 08:22:19 +02:00
parent 26cb6994c4
commit 4636bb6907

View File

@@ -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)