diff options
-rw-r--r-- | src/corelib/global/qglobalstatic.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/global/qglobalstatic.h b/src/corelib/global/qglobalstatic.h index 7ed85ba41a..c7fbba69e8 100644 --- a/src/corelib/global/qglobalstatic.h +++ b/src/corelib/global/qglobalstatic.h @@ -40,9 +40,10 @@ template <typename QGS> union Holder ~Holder() { + // import changes to *pointer() by other threads before running ~PlainType(): + std::atomic_thread_fence(std::memory_order_acquire); pointer()->~PlainType(); - std::atomic_thread_fence(std::memory_order_acquire); // avoid mixing stores to guard and *pointer() - guard.storeRelaxed(QtGlobalStatic::Destroyed); + guard.storeRelease(QtGlobalStatic::Destroyed); } PlainType *pointer() noexcept |