XCB: fix GCC 12 warning about uninitialized variable use

GCC is right that symbolsGroup2 could remain uninitialized for some
conditions. So always initialize it.

qxcbkeyboard.cpp:284:48: error: ‘symbolsGroup2’ may be used uninitialized [-Werror=maybe-uninitialized]

Pick-to: 6.2 6.3
Change-Id: If05aeeb7176e4f13af9afffd16e84af7d7806b0d
Reviewed-by: Zhang Hao <543985125@qq.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Thiago Macieira 2022-04-22 11:21:31 -07:00
parent 1fbd8c282e
commit e92e48bc79

View File

@ -257,7 +257,7 @@ struct xkb_keymap *QXcbKeyboard::keymapFromCore(const KeysymModifierMap &keysymM
const int maxGroup1 = 4; // We only support 4 shift states anyway
const int maxGroup2 = 2; // Only 3rd and 4th keysym are group 2
xcb_keysym_t symbolsGroup1[maxGroup1];
xcb_keysym_t symbolsGroup2[maxGroup2];
xcb_keysym_t symbolsGroup2[maxGroup2] = { XKB_KEY_NoSymbol, XKB_KEY_NoSymbol };
for (int i = 0; i < maxGroup1 + maxGroup2; i++) {
xcb_keysym_t sym = i < keysymsPerKeycode ? codeMap[i] : XKB_KEY_NoSymbol;
if (mapGroup2ToLevel3) {