summaryrefslogtreecommitdiffstats
path: root/util/system/atexit.cpp
diff options
context:
space:
mode:
authorthegeorg <[email protected]>2022-06-24 12:22:44 +0300
committerthegeorg <[email protected]>2022-06-24 12:22:44 +0300
commitece86e83e77dcf3d9e757517d3d16f707272a4c7 (patch)
tree6366c9b5116ff7606a9706074bf4a7db0c17279c /util/system/atexit.cpp
parenta4c1572074a6f4eb937168c283a61c43468d8650 (diff)
Allow creating Singlelon during Singleton destruction back again
ref:53c837a1fa0289db60812b95b6ac96be23ae018d
Diffstat (limited to 'util/system/atexit.cpp')
-rw-r--r--util/system/atexit.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/system/atexit.cpp b/util/system/atexit.cpp
index 5ae7a21e233..7fafad95a6a 100644
--- a/util/system/atexit.cpp
+++ b/util/system/atexit.cpp
@@ -81,9 +81,10 @@ namespace {
alignas(TAtExit) static char atExitMem[sizeof(TAtExit)];
static void OnExit() {
- if (TAtExit* const atExit = atExitPtr.exchange(nullptr)) {
+ if (TAtExit* const atExit = atExitPtr.load()) {
atExit->Finish();
atExit->~TAtExit();
+ atExitPtr.store(nullptr);
}
}