diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-05-13 15:49:42 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-05-14 08:01:57 +0000 |
commit | c1829ea50bf5c99428f0a19887c503b4c7bd4b9a (patch) | |
tree | aa732114d10cd45ff279fcd96d085048a8c1972c | |
parent | 026edef351a73f75c0a0ce12c8afb9ef1aa19139 (diff) |
Fix illegal downcast on QQmlEngine destruction
Make QQmlEnginePrivate::isEngineThread() legal to call during
QQmlEngine destruction.
Change-Id: I2bae9d70883cf8013f39f2046ebe83bb8dbcd46b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | src/qml/qml/qqmlengine_p.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h index d05c945ae4..92e56cd957 100644 --- a/src/qml/qml/qqmlengine_p.h +++ b/src/qml/qml/qqmlengine_p.h @@ -309,8 +309,8 @@ Returns true if the calling thread is the QQmlEngine thread. */ bool QQmlEnginePrivate::isEngineThread() const { - Q_Q(const QQmlEngine); - return QThread::currentThread() == q->thread(); + + return QThread::currentThread() == q_ptr->thread(); } /*! @@ -335,8 +335,6 @@ the instance directly if not. template<typename T> void QQmlEnginePrivate::deleteInEngineThread(T *value) { - Q_Q(QQmlEngine); - Q_ASSERT(value); if (isEngineThread()) { delete value; @@ -352,7 +350,7 @@ void QQmlEnginePrivate::deleteInEngineThread(T *value) toDeleteInEngineThread.append(i); mutex.unlock(); if (wasEmpty) - QCoreApplication::postEvent(q, new QEvent(QEvent::User)); + QCoreApplication::postEvent(q_ptr, new QEvent(QEvent::User)); } } |