aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-05-04 16:37:26 +0100
committerVaxry <[email protected]>2024-05-04 16:37:26 +0100
commitc77b60c91073471c0910c40b4df2baa08e01fa9b (patch)
tree511fcbd9c20863c30a50a9a8a413afcd7cbd6ade
parentc951c4f8a1bf02e03c7efbe9a8887c1657ef95d3 (diff)
downloadHyprland-c77b60c91073471c0910c40b4df2baa08e01fa9b.tar.gz
Hyprland-c77b60c91073471c0910c40b4df2baa08e01fa9b.zip
keyboard: prevent UAF in destroy events
-rw-r--r--src/devices/Keyboard.cpp2
-rw-r--r--src/devices/VirtualKeyboard.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/devices/Keyboard.cpp b/src/devices/Keyboard.cpp
index 11257a74..17357edb 100644
--- a/src/devices/Keyboard.cpp
+++ b/src/devices/Keyboard.cpp
@@ -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) {
diff --git a/src/devices/VirtualKeyboard.cpp b/src/devices/VirtualKeyboard.cpp
index fa91ae9f..dfe3c6df 100644
--- a/src/devices/VirtualKeyboard.cpp
+++ b/src/devices/VirtualKeyboard.cpp
@@ -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) {