From f792fed2ff519ffac1436e41e47cc0504d253a77 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 5 Mar 2019 14:25:45 +0100 Subject: [PATCH] XCB/libxkbcommon input context: Fix crash when invalid local is set Fall back to querying the locale. Fixes: QTBUG-74216 Change-Id: Ibd60572454741e64f649ecc3e37f593a8e2b2bda Reviewed-by: Edward Welbourne --- .../compose/qcomposeplatforminputcontext.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp index 6b9687c22d..57fe7c2fa2 100644 --- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp @@ -70,7 +70,9 @@ void QComposeInputContext::ensureInitialized() } m_initialized = true; - const char *const locale = setlocale(LC_CTYPE, ""); + const char *locale = setlocale(LC_CTYPE, ""); + if (!locale) + locale = setlocale(LC_CTYPE, nullptr); qCDebug(lcXkbCompose) << "detected locale (LC_CTYPE):" << locale; m_composeTable = xkb_compose_table_new_from_locale(m_XkbContext, locale, XKB_COMPOSE_COMPILE_NO_FLAGS);