Create QLocale's default store if missing when setDefault() is called
A check to prevent crash-on-exit if QLocale::setDefault() was called after the default store was torn down had the side-effect of causing setDefault() to not record data if it was called before the first access to the default store caused it to come into being. Change the check to test that the default store has been destroyed and, if not, create it if it doesn't exist yet. This refines commit4d6572aac0
(as modified by commit11c5c078c7
). Fixes: QTBUG-83016 Fixes: QTBUG-83415 Pick-to: 5.15 Change-Id: Icbce9bd9c75d0258d403e2f90957561b5a18bdf3 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
ee8ba0e0ca
commit
c7420d9cb8
@ -1225,7 +1225,15 @@ void QLocale::setDefault(const QLocale &locale)
|
||||
{
|
||||
default_data = locale.d->m_data;
|
||||
|
||||
if (defaultLocalePrivate.exists()) // update the cached private
|
||||
if (defaultLocalePrivate.isDestroyed())
|
||||
return; // avoid crash on exit
|
||||
if (!defaultLocalePrivate.exists()) {
|
||||
// Force it to exist; see QTBUG-83016
|
||||
QLocale ignoreme;
|
||||
Q_ASSERT(defaultLocalePrivate.exists());
|
||||
}
|
||||
|
||||
// update the cached private
|
||||
*defaultLocalePrivate = locale.d;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user