summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2016-07-16 14:43:50 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2016-07-19 11:28:55 +0000
commitc8277b6e5322da5fa74cf81e295c8ed71beb1624 (patch)
tree1b91507dadaabe42a79429cc6c7bb8a476b15858 /src
parent091df96fb8da356dc9de81dc390f55e66d4d7c01 (diff)
QThread: make it fatal to destroy a running QThread
Align ourselves to what std::thread does (and what's sensible to do anyhow, since we even document that "Deleting a running QThread [...] will probably result in a program crash"). [ChangeLog][QtCore][QThread] Destroying a QThread which is still running will now result in immediate and abnormal program termination. Change-Id: Ib481287915be01a1381df14abf6e0fb68c36b5b5 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/thread/qthread.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 4aac24f454..7118ad5c9b 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -403,7 +403,7 @@ QThread::QThread(QThreadPrivate &dd, QObject *parent)
Note that deleting a QThread object will not stop the execution
of the thread it manages. Deleting a running QThread (i.e.
- isFinished() returns \c false) will probably result in a program
+ isFinished() returns \c false) will result in a program
crash. Wait for the finished() signal before deleting the
QThread.
*/
@@ -418,7 +418,7 @@ QThread::~QThread()
locker.relock();
}
if (d->running && !d->finished && !d->data->isAdopted)
- qWarning("QThread: Destroyed while thread is still running");
+ qFatal("QThread: Destroyed while thread is still running");
d->data->thread = 0;
}