QLocale/Mac: make envVarLocale() thread-safe

The old code used a static QByteArray, but would write to it on every
invocation of the function. This makes the function non-re-entrant,
even though it's callable from non-GUI-threads (via
QSystemLocale::fallbackUiLocale()).

Fix by using an automatic QByteArray instead.

Change-Id: I93eea1dff1c72f3ea280283bb68b4ed47d2a8e1d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2020-05-06 11:17:24 +02:00
parent a245945f29
commit 9a66dff369

View File

@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
static QByteArray envVarLocale()
{
static QByteArray lang;
QByteArray
#ifdef Q_OS_UNIX
lang = qgetenv("LC_ALL");
if (lang.isEmpty())