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>bb10
parent
214016835f
commit
31e414d36e
|
|
@ -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…
Reference in New Issue