hid: don't access expired resources in virtual devices

fixes #5868
This commit is contained in:
Vaxry 2024-05-04 12:35:56 +01:00
parent 2d40046f24
commit 25964e5a2b
2 changed files with 6 additions and 0 deletions

View file

@ -55,6 +55,8 @@ bool CVirtualKeyboard::isVirtual() {
} }
wlr_keyboard* CVirtualKeyboard::wlr() { wlr_keyboard* CVirtualKeyboard::wlr() {
if (keyboard.expired())
return nullptr;
return keyboard.lock()->wlr(); return keyboard.lock()->wlr();
} }
@ -67,5 +69,7 @@ void CVirtualKeyboard::disconnectCallbacks() {
} }
wl_client* CVirtualKeyboard::getClient() { wl_client* CVirtualKeyboard::getClient() {
if (keyboard.expired())
return nullptr;
return keyboard.lock()->client(); return keyboard.lock()->client();
} }

View file

@ -166,5 +166,7 @@ void CVirtualPointer::disconnectCallbacks() {
} }
wlr_pointer* CVirtualPointer::wlr() { wlr_pointer* CVirtualPointer::wlr() {
if (pointer.expired())
return nullptr;
return pointer.lock()->wlr(); return pointer.lock()->wlr();
} }