QGlobalStatic: invert the order of destruction and setting the guard
This is how the old implementation did it: the Type member was a member of Holder, but the guard was set to Destroyed in the HolderBase destructor, which ran after. I find the way I implemented in commit81a31beeb25eaf14d5c5f42fe26aa49d6ef29bf8 to be more natural, but it caused regressions at runtime for code that attempted to reenter the global static on destruction. Not unit-tested because I don't know if we want to keep this forever. Pick-to: 6.3 Fixes: QTBUG-99192 Change-Id: Ib42b3adc93bf4d43bd55fffd16c09d7f835d121e Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
parent
602a186cb4
commit
e3e2674100
@ -76,9 +76,9 @@ template <typename QGS> union Holder
|
||||
|
||||
~Holder()
|
||||
{
|
||||
guard.storeRelaxed(QtGlobalStatic::Destroyed);
|
||||
std::atomic_thread_fence(std::memory_order_acquire); // avoid mixing stores to guard and *pointer()
|
||||
pointer()->~PlainType();
|
||||
std::atomic_thread_fence(std::memory_order_acquire); // avoid mixing stores to guard and *pointer()
|
||||
guard.storeRelaxed(QtGlobalStatic::Destroyed);
|
||||
}
|
||||
|
||||
PlainType *pointer() noexcept
|
||||
|
Loading…
Reference in New Issue
Block a user