diff options
author | Dominik Holland <dominik.holland@pelagicore.com> | 2019-09-03 15:20:27 +0200 |
---|---|---|
committer | Dominik Holland <dominik.holland@pelagicore.com> | 2019-09-03 19:25:42 +0200 |
commit | 30091b4aaac3898753c3aff95a6e5b8570886dec (patch) | |
tree | cc0cc6ad95ddb5cfc84a3105cfdf83a6e89cc05f | |
parent | 582c91cda2c2831f666fa99d39e4637d7828927f (diff) | |
download | qtivi-30091b4aaac3898753c3aff95a6e5b8570886dec.tar.gz |
geniviextras: Fix potential crash during Qt cleanup
During the Qt cleanup, some parts of QtCore are still using qDebug and
friends to e.g. when QT_DEBUG_PLUGINS is set.
Because of this the messageHandler might be called while the
QDltRegistration is already destroyed. In this case the messageHandler
can't log anymore, but it also shouldn't crash because of a nullptr
access.
Change-Id: I4d75acc5dfacca89d4876c13580c9d7bf2838f69
Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
-rw-r--r-- | src/geniviextras/qdltregistration.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/geniviextras/qdltregistration.cpp b/src/geniviextras/qdltregistration.cpp index 8f2f080..091d201 100644 --- a/src/geniviextras/qdltregistration.cpp +++ b/src/geniviextras/qdltregistration.cpp @@ -473,6 +473,9 @@ void QDltRegistration::unregisterApplication() */ void QDltRegistration::messageHandler(QtMsgType msgType, const QMessageLogContext &msgCtx, const QString &msg) { + if (!globalDltRegistration()) + return; + QMutexLocker l(&globalDltRegistration()->d_ptr->m_mutex); DltContext *dltCtx = globalDltRegistration()->d_ptr->context(msgCtx.category); |