File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -993,7 +993,17 @@ class Framework {
993
993
}
994
994
995
995
private:
996
+ friend void ::xptiFrameworkFinalize ();
997
+
998
+ static Framework *release () {
999
+ Framework *TmpFramework = MInstance.load (std::memory_order_relaxed);
1000
+ MInstance.store (nullptr , std::memory_order_relaxed);
1001
+ return TmpFramework;
1002
+ }
1003
+
1004
+ // / Stores singleton instance
996
1005
static std::atomic<Framework *> MInstance;
1006
+ // / Trivially destructible mutex for double-checked lock idiom
997
1007
static utils::SpinLock MSingletoneMutex;
998
1008
// / Thread-safe counter used for generating universal IDs
999
1009
xpti::safe_uint64_t MUniversalIDs;
@@ -1031,7 +1041,9 @@ XPTI_EXPORT_API void xptiFrameworkFinalize() {
1031
1041
1032
1042
xpti::GFrameworkReferenceCounter--;
1033
1043
if (xpti::GFrameworkReferenceCounter == 0 ) {
1034
- delete &xpti::Framework::instance ();
1044
+ xpti::Framework *FW = xpti::Framework::release ();
1045
+ if (FW)
1046
+ delete FW;
1035
1047
}
1036
1048
}
1037
1049
You can’t perform that action at this time.
0 commit comments