summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qthread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/thread/qthread.cpp')
-rw-r--r--src/corelib/thread/qthread.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 066e9e390a6..a936d189f4c 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -438,6 +438,15 @@ QThread::QThread(QThreadPrivate &dd, QObject *parent)
isFinished() returns \c false) will result in a program
crash. Wait for the finished() signal before deleting the
QThread.
+
+ Since Qt 6.3, it is allowed to delete a QThread instance created by
+ a call to QThread::create() even if the corresponding thread is
+ still running. In such a case, Qt will post an interruption request
+ to that thread (via requestInterruption()); will ask the thread's
+ event loop (if any) to quit (via quit()); and will block until the
+ thread has finished.
+
+ \sa create(), isInterruptionRequested(), exec(), quit()
*/
QThread::~QThread()
{
@@ -1101,6 +1110,13 @@ public:
{
}
+ ~QThreadCreateThread()
+ {
+ requestInterruption();
+ quit();
+ wait();
+ }
+
private:
void run() override
{