diff options
author | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2023-08-09 12:03:59 +0200 |
---|---|---|
committer | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2023-08-10 19:45:51 +0200 |
commit | 31e414d36e59424af5c459cf0f87333eba0f4a57 (patch) | |
tree | e08fee01b9a253d377d2085954b7424c3463a65c /src/corelib/global/qglobalstatic.h | |
parent | 214016835f198ce5150862d97288760820d9e494 (diff) |
Q_GLOBAL_STATIC: Use Q_FUNC_INFO for assertion contexts
Using Q_FUNC_INFO has an advantage that at least GCC includes
the variable type and name into the string. This makes it much
easier to understand access to which global static is causing
an assertion.
Pick-to: 6.6
Change-Id: Ie6ce992921c0969df262fed22024a22650783f93
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/global/qglobalstatic.h')
-rw-r--r-- | src/corelib/global/qglobalstatic.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/global/qglobalstatic.h b/src/corelib/global/qglobalstatic.h index 9c0e9c97b2..7ed85ba41a 100644 --- a/src/corelib/global/qglobalstatic.h +++ b/src/corelib/global/qglobalstatic.h @@ -74,13 +74,13 @@ template <typename Holder> struct QGlobalStatic } Type *operator->() { - Q_ASSERT_X(!isDestroyed(), "Q_GLOBAL_STATIC", + Q_ASSERT_X(!isDestroyed(), Q_FUNC_INFO, "The global static was used after being destroyed"); return instance(); } Type &operator*() { - Q_ASSERT_X(!isDestroyed(), "Q_GLOBAL_STATIC", + Q_ASSERT_X(!isDestroyed(), Q_FUNC_INFO, "The global static was used after being destroyed"); return *instance(); } |