mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-03 05:31:59 -07: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:
@@ -1226,12 +1226,20 @@ void CInputManager::destroyKeyboard(SP<IKeyboard> pKeyboard) {
|
||||
std::erase_if(m_vKeyboards, [pKeyboard](const auto& other) { return other == pKeyboard; });
|
||||
|
||||
if (m_vKeyboards.size() > 0) {
|
||||
const auto PNEWKEYBOARD = m_vKeyboards.back();
|
||||
g_pSeatManager->setKeyboard(PNEWKEYBOARD);
|
||||
PNEWKEYBOARD->active = true;
|
||||
} else {
|
||||
bool found = false;
|
||||
for (auto& k : m_vKeyboards | std::views::reverse) {
|
||||
if (!k->wlr())
|
||||
continue;
|
||||
|
||||
g_pSeatManager->setKeyboard(k);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
g_pSeatManager->setKeyboard(nullptr);
|
||||
} else
|
||||
g_pSeatManager->setKeyboard(nullptr);
|
||||
}
|
||||
|
||||
removeFromHIDs(pKeyboard);
|
||||
}
|
||||
|
Reference in New Issue
Block a user