Don't change process locale while initializing QWaylandInputContext

This was overriding the locale previously set in
QCoreApplicationPrivate::initLocale and can switch the process to
non-UTF8 codepage

Pick-to: 6.5 6.4 6.2
Change-Id: I5cd6664d1a7c315019d6c798b33b9deb33982a59
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ilya Fedin 2023-01-25 17:07:07 +04:00 committed by Thiago Macieira
parent 41a9ffeb0c
commit 0c96282e97

View File

@ -222,9 +222,7 @@ void QWaylandInputContext::ensureInitialized()
}
m_initialized = true;
const char *locale = setlocale(LC_CTYPE, "");
if (!locale)
locale = setlocale(LC_CTYPE, nullptr);
const char *const locale = setlocale(LC_CTYPE, nullptr);
qCDebug(qLcQpaInputMethods) << "detected locale (LC_CTYPE):" << locale;
m_composeTable = xkb_compose_table_new_from_locale(m_XkbContext, locale, XKB_COMPOSE_COMPILE_NO_FLAGS);