mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 09:25:59 +01:00
seatmgr: fix missing nullcheck in updateActiveKeyboardData
sometimes we may set a keyboard that's about-to-be-deleted, we might as well check for that additionally avoid setting null keyboards altogether
This commit is contained in:
parent
c7e85e26f7
commit
9d7d5ec3c8
2 changed files with 14 additions and 6 deletions
|
@ -94,7 +94,7 @@ void CSeatManager::setKeyboard(SP<IKeyboard> KEEB) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSeatManager::updateActiveKeyboardData() {
|
void CSeatManager::updateActiveKeyboardData() {
|
||||||
if (keyboard)
|
if (keyboard && keyboard->wlr())
|
||||||
PROTO::seat->updateRepeatInfo(keyboard->wlr()->repeat_info.rate, keyboard->wlr()->repeat_info.delay);
|
PROTO::seat->updateRepeatInfo(keyboard->wlr()->repeat_info.rate, keyboard->wlr()->repeat_info.delay);
|
||||||
PROTO::seat->updateKeymap();
|
PROTO::seat->updateKeymap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1226,12 +1226,20 @@ void CInputManager::destroyKeyboard(SP<IKeyboard> pKeyboard) {
|
||||||
std::erase_if(m_vKeyboards, [pKeyboard](const auto& other) { return other == pKeyboard; });
|
std::erase_if(m_vKeyboards, [pKeyboard](const auto& other) { return other == pKeyboard; });
|
||||||
|
|
||||||
if (m_vKeyboards.size() > 0) {
|
if (m_vKeyboards.size() > 0) {
|
||||||
const auto PNEWKEYBOARD = m_vKeyboards.back();
|
bool found = false;
|
||||||
g_pSeatManager->setKeyboard(PNEWKEYBOARD);
|
for (auto& k : m_vKeyboards | std::views::reverse) {
|
||||||
PNEWKEYBOARD->active = true;
|
if (!k->wlr())
|
||||||
} else {
|
continue;
|
||||||
|
|
||||||
|
g_pSeatManager->setKeyboard(k);
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
g_pSeatManager->setKeyboard(nullptr);
|
||||||
|
} else
|
||||||
g_pSeatManager->setKeyboard(nullptr);
|
g_pSeatManager->setKeyboard(nullptr);
|
||||||
}
|
|
||||||
|
|
||||||
removeFromHIDs(pKeyboard);
|
removeFromHIDs(pKeyboard);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue