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. Change-Id: Ie6ce992921c0969df262fed22024a22650783f93 Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit 31e414d36e59424af5c459cf0f87333eba0f4a57) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
8442b05bdd
commit
94124571b5
@ -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();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user