diff options
author | Sérgio Martins <sergio.martins@kdab.com> | 2013-12-11 10:02:17 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-12 11:47:16 +0100 |
commit | d34098d8981d9103626ff7264e7b5ec084bfb63e (patch) | |
tree | f1c47ccd70290dd02498e41eb84a0595f0f335e5 /src | |
parent | 91e2c5d749e38eed93e91b14151faa549e70080f (diff) |
Don't crash when QCoreApplication is currently being deleted.
In debug mode fixes a crash. The next Q_ASSERT dereferrenced
QCoreApplication::instance().
In release mode fixes hundreds of messages about timers:
"QObject::startTimer: Timers can only be used with threads started
with QThread"
A case where this is reproducible is having a QQuickItem that's child
of qApp, or in some child hierarchy of qApp.
Change-Id: I3b506aefdb537b74dc0d6c755b6874d31be159a1
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index 9426db70d0..6c27cb68c7 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -980,6 +980,9 @@ void QSGThreadedRenderLoop::maybeUpdate(QQuickWindow *window) */ void QSGThreadedRenderLoop::maybeUpdate(Window *w) { + if (!QCoreApplication::instance()) + return; + Q_ASSERT_X(QThread::currentThread() == QCoreApplication::instance()->thread() || m_locked, "QQuickItem::update()", "Function can only be called from GUI thread or during QQuickItem::updatePaintNode()"); |