From 31e414d36e59424af5c459cf0f87333eba0f4a57 Mon Sep 17 00:00:00 2001 From: Ievgenii Meshcheriakov Date: Wed, 9 Aug 2023 12:03:59 +0200 Subject: [PATCH] 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 --- src/corelib/global/qglobalstatic.h | 4 ++-- 1 file 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 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(); }