diff options
author | Szabolcs David <davidsz@inf.u-szeged.hu> | 2021-07-16 12:31:23 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-07-21 08:22:49 +0000 |
commit | 5ac1b763be02959d6f1ed10b0459a618b36e7fff (patch) | |
tree | eeeba41c234240e956184d577e603b85ef2d8eb8 | |
parent | a0958b05400bd67ddce2bcc183759c879480a3c0 (diff) |
Fix assertion in getCurrentKeyboardLayout()
FATAL:xkb_keyboard_layout_engine.cc(640)] Keymap file failed to load: hu-us
If there are multiple layouts provided (eg. "hu,us") and there is no
layout variant, we appended the second layout as a variant (eg. "hu-us").
This happens because strtok() caches the pointer of the next token from
its previous call and uses that when processing a null string.
Change-Id: Ic1d8bd14f95bda65a9fba82c1df45af306c4445b
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
(cherry picked from commit 77c7d56531966ff444ebf9bab52f01da9bb4be21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/core/ozone/ozone_platform_qt.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core/ozone/ozone_platform_qt.cpp b/src/core/ozone/ozone_platform_qt.cpp index 7e2dc4edc..5b42acd9f 100644 --- a/src/core/ozone/ozone_platform_qt.cpp +++ b/src/core/ozone/ozone_platform_qt.cpp @@ -175,6 +175,9 @@ static std::string getCurrentKeyboardLayout() return std::string(); } + if (!vdr.variant) + return layout; + char *variant = strtok(vdr.variant, ","); if (!variant) return layout; |