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 <edward.welbourne@qt.io>
This commit is contained in:
Friedemann Kleint 2019-03-05 14:25:45 +01:00 committed by Edward Welbourne
parent 1b5dbebb93
commit f792fed2ff

View File

@ -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);