QLocale: fix crash when using qDebug() in a global destructor
`kdevelop -s doesnotexist` led to ASSERT failure in Q_GLOBAL_STATIC: "The global static was used after being destroyed because of a qDebug() statement in some "unregister" method called by a global object's destructor. This is normally fine, but with %{time} in QT_MESSAGE_PATTERN, qDebug() ends up using QLocale after its global objects (systemLocalePrivate and defaultLocalePrivate) were destroyed. Change-Id: I8d8b34e0197ad1eda8283fcf36d2c250385bb1a3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
7044409c87
commit
6e21c9ac4a
@ -2367,6 +2367,8 @@ QLocale QLocale::system()
|
||||
{
|
||||
// this function is NOT thread-safe!
|
||||
QT_PREPEND_NAMESPACE(systemData)(); // trigger updating of the system data if necessary
|
||||
if (systemLocalePrivate.isDestroyed())
|
||||
return QLocale(QLocale::C);
|
||||
return QLocale(*systemLocalePrivate->data());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user