diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-10-16 22:31:42 -0700 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-10-27 20:00:27 +0000 |
commit | cf2220385506fe9f94ef1dbfa43518e489e04155 (patch) | |
tree | d9b409d8e5a19e12a58e7ded5992a5ce7fa9ebc8 /LICENSE.LGPL3 | |
parent | efb1a13282ec0d09326b0550df67b7b8e7e9a31e (diff) |
Add a comment about the weird refcount for adopted QThreadData
It's perfectly benign, but I spent a lot of time debugging this and
trying to figure out how to solve something that didn't need solving. So
document for posterity.
For an adopted thread, the TLS destructors or the adopted thread watcher
on Windows will call QThreadData::deref():
- QThreadData::deref(), count drops to zero
-> delete this;
- ~QThreadData() deletes the QAdoptedThread
-> delete t;
- ~QThreadPrivate() calls deref() again
-> data->deref();
- QThreadData::deref(), count drops to -1, no action taken
- ~QObjectPrivate() calls deref() yet again
-> threadData->deref()
- QThreadData::deref(), count drops to -2, no action taken
Change-Id: Icaa86fc7b54d4b368c0efffd14ee448e0796e8d7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'LICENSE.LGPL3')
0 files changed, 0 insertions, 0 deletions