summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qthread.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-11-05 17:58:48 +0100
committerLiang Qi <liang.qi@qt.io>2017-11-05 18:02:18 +0100
commita7e4b645dc5b164eb31c22b558ae7a2f5b674afb (patch)
treec58ac922346363c265ad6873cefe9ed205d84a1d /src/corelib/thread/qthread.cpp
parentcd542a82b0c2d5c9a4ea167a84e5ea8a25c5d969 (diff)
parentea0e868c4881944207e9b3a77011e05a505ff3b7 (diff)
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts: src/corelib/global/minimum-linux.S src/network/access/qhttpthreaddelegate.cpp src/widgets/kernel/qwidgetwindow.cpp Change-Id: Id2e817e85f85c68f5482c9a12912d35590f9d5f8
Diffstat (limited to 'src/corelib/thread/qthread.cpp')
-rw-r--r--src/corelib/thread/qthread.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index e92be64dfa..cad7a14017 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -78,6 +78,13 @@ QThreadData::~QThreadData()
QThreadData::clearCurrentThreadData();
}
+ // ~QThread() sets thread to nullptr, so if it isn't null here, it's
+ // because we're being run before the main object itself. This can only
+ // happen for QAdoptedThread. Note that both ~QThreadPrivate() and
+ // ~QObjectPrivate() will deref this object again, but that is acceptable
+ // because this destructor is still running (the _ref sub-object has not
+ // been destroyed) and there's no reentrancy. The refcount will become
+ // negative, but that's acceptable.
QThread *t = thread;
thread = 0;
delete t;