diff options
author | Olivier Goffart <ogoffart@kde.org> | 2011-11-03 13:11:34 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-19 04:42:49 (GMT) |
commit | 82566b811c2d0714f4a2bd23ef040b6e8a5f18bd (patch) | |
tree | 410083b8524a00df6e5c8be7e247f40089eedf89 /src | |
parent | 3fe6a74576f8c0c4e04343e0db94364f76fea407 (diff) | |
download | Qt-82566b811c2d0714f4a2bd23ef040b6e8a5f18bd.zip Qt-82566b811c2d0714f4a2bd23ef040b6e8a5f18bd.tar.gz Qt-82566b811c2d0714f4a2bd23ef040b6e8a5f18bd.tar.bz2 |
QThread::isFinished should return true from finished()
and isRunning() should return false.
This restore the Qt 4.7 behaviour
In Qt 4.7, the finished() was called with the thread's intenal mutex
locked. Which mean that:
- Call to isRunning or isFinished called from a slot connected to
finish within the thread would deadlock. (Hence no compatibility
to keep here)
- Call to isRunning or isFinished from a slot connected with
QueuedConnection in another thread would lock the mutex until
the destructors are finished. and then return as if the thread have
finished.
Change-Id: I963eccae8f7634aff90cc4bbab6ca886a78e35eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry-picked from qtbase commit ec5e59b73c20a7dc6aec96c829f1e53c3fa58c07)
Task-number: QTBUG-30251
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/thread/qthread.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 53e4d5e..74bbd4e 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -457,7 +457,7 @@ bool QThread::isFinished() const { Q_D(const QThread); QMutexLocker locker(&d->mutex); - return d->finished; + return d->finished || d->isInFinish; } /*! @@ -475,7 +475,7 @@ bool QThread::isRunning() const if (d->data->symbian_thread_handle.Handle() && d->data->symbian_thread_handle.ExitType() != EExitPending) return false; #endif - return d->running; + return d->running && !d->isInFinish; } /*! |