From: Thiago Macieira Date: Fri, 24 Jan 2025 18:43:38 +0000 (-0800) Subject: [PATCH] QLocale: try to survive being created during application shut down X-Git-Tag: archive/raspbian/6.8.2+dfsg-6+rpi1^2~11 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=125ee9631b2b0b47fe4b3e56eff3ed456ea4bece;p=qt6-base.git [PATCH] QLocale: try to survive being created during application shut down QLocale is very often accessed during global static destructors, so let's try and survive if the default has already been destroyed. In that case, we shall fall back to the C locale. I've placed the call to systemData(), which updates the system locale, before the initialization of defaultLocalePrivate, as the initialization of the latter depends on the former. Task-number: QTBUG-133206 Change-Id: I48e29b45f9be4514336cfffdf5affa5631a956a3 Reviewed-by: Edward Welbourne Reviewed-by: Albert Astals Cid (cherry picked from commit e0a1f491567f2495443babc5aa36a038260f96c6) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit bcc0e6124a2ec80df535178d056324433f9ff984) Gbp-Pq: Name upstream_qlocale_shutdown.patch --- diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 4f5b5452..eff083b3 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -1112,10 +1112,13 @@ QLocale::QLocale(QStringView name) */ QLocale::QLocale() - : d(*defaultLocalePrivate) + : d(c_private()) { - // Make sure system data is up to date: - systemData(); + if (!defaultLocalePrivate.isDestroyed()) { + // Make sure system data is up to date: + systemData(); + d = *defaultLocalePrivate; + } } /*!