diff options
| author | Thiago Macieira <thiago.macieira@intel.com> | 2025-01-09 18:10:12 -0300 |
|---|---|---|
| committer | Thiago Macieira <thiago.macieira@intel.com> | 2025-01-12 12:38:01 -0300 |
| commit | 2f69a05bd0cd7ce63890f709ff3ed7a4f78acd70 (patch) | |
| tree | 76821a8c89a67909b7c1111ea3e8a4f0b7be1599 /src/corelib/tools/qcommandlineparser.cpp | |
| parent | bfbd1a281dd00c47df315c06e895bf5d53cd8764 (diff) | |
QThread/Unix: move the pthread_key to a file-scope static
So that the pthread_key is destroyed much later than now, at QtCore
unload time instead of a bit earlier in exit(). That's important so it
runs later than the Q_DESTRUCTOR_FUNCTION for QLibraryStore
(qlibrary.cpp), which is what unloads plugins, whose unload-time
destructors may be attempting to quit() & wait() for their worker
threads.
I had to keep the destruction of the exiting thread's adopted thread
where it was: a function-local static's destructor. As noted in the
comment added by 1da7558bfd7626bcc40a214a90ae5027f32f6c7f, we need
QThreadData::cleanup() to run before the libraries start to unload
because we need to delete the event dispatcher.
Init priority 10 will place it after the QHash random seed and qsimd
initialization, on ELF systems and on Windows. On other systems (incl.
Apple ones), the order probably depends on the order of the files in the
CMakeLists.txt. I thought that would mean the destructor for thread/
would run before plugin/ but that apparently is not the case. But that's
fragile.
Amends 1da7558bfd7626bcc40a214a90ae5027f32f6c7f, which amended other
things...
Fixes: QTBUG-132697
Task-number: QTBUG-102984
Task-number: QTBUG-132381
Pick-to: 6.9 6.8
Change-Id: Id7263d6ffe7a5949cd84e35d942ad0e02df1b455
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/tools/qcommandlineparser.cpp')
0 files changed, 0 insertions, 0 deletions
