keyboard: prevent UAF in destroy events

This commit is contained in:
Vaxry 2024-05-04 16:37:26 +01:00
parent c951c4f8a1
commit c77b60c910
2 changed files with 2 additions and 2 deletions

View file

@ -23,9 +23,9 @@ CKeyboard::CKeyboard(wlr_keyboard* keeb) : keyboard(keeb) {
// clang-format off
hyprListener_destroy.initCallback(&keeb->base.events.destroy, [this] (void* owner, void* data) {
events.destroy.emit();
disconnectCallbacks();
keyboard = nullptr;
events.destroy.emit();
}, this, "CKeyboard");
hyprListener_key.initCallback(&keeb->events.key, [this] (void* owner, void* data) {

View file

@ -18,9 +18,9 @@ CVirtualKeyboard::CVirtualKeyboard(SP<CVirtualKeyboardV1Resource> keeb_) : keybo
// clang-format off
hyprListener_destroy.initCallback(&keeb->base.events.destroy, [this] (void* owner, void* data) {
events.destroy.emit();
disconnectCallbacks();
keyboard.reset();
events.destroy.emit();
}, this, "CVirtualKeyboard");
hyprListener_key.initCallback(&keeb->events.key, [this] (void* owner, void* data) {