summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qglobalstatic.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global/qglobalstatic.h')
-rw-r--r--src/corelib/global/qglobalstatic.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/corelib/global/qglobalstatic.h b/src/corelib/global/qglobalstatic.h
index e56fe1dbcb..a0dfd462fd 100644
--- a/src/corelib/global/qglobalstatic.h
+++ b/src/corelib/global/qglobalstatic.h
@@ -132,17 +132,29 @@ struct QGlobalStatic
bool isDestroyed() const { return guard.loadRelaxed() <= QtGlobalStatic::Destroyed; }
bool exists() const { return guard.loadRelaxed() == QtGlobalStatic::Initialized; }
- operator Type *() { if (isDestroyed()) return nullptr; return innerFunction(); }
- Type *operator()() { if (isDestroyed()) return nullptr; return innerFunction(); }
+ operator Type *()
+ {
+ if (isDestroyed())
+ return nullptr;
+ return innerFunction();
+ }
+ Type *operator()()
+ {
+ if (isDestroyed())
+ return nullptr;
+ return innerFunction();
+ }
Type *operator->()
{
- Q_ASSERT_X(!isDestroyed(), "Q_GLOBAL_STATIC", "The global static was used after being destroyed");
- return innerFunction();
+ Q_ASSERT_X(!isDestroyed(), "Q_GLOBAL_STATIC",
+ "The global static was used after being destroyed");
+ return innerFunction();
}
Type &operator*()
{
- Q_ASSERT_X(!isDestroyed(), "Q_GLOBAL_STATIC", "The global static was used after being destroyed");
- return *innerFunction();
+ Q_ASSERT_X(!isDestroyed(), "Q_GLOBAL_STATIC",
+ "The global static was used after being destroyed");
+ return *innerFunction();
}
};