1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:07:35 +00:00

Kernel/HID: Take a spinlock when calling KeyboardClient::on_key_pressed

The KeyboardClient class member could be updated due to TTY switch, so
we must ensure we always use a valid pointer.
This commit is contained in:
Liav A 2022-05-06 14:49:13 +03:00 committed by Linus Groh
parent b8493bf70f
commit cd08c4a5aa
3 changed files with 14 additions and 3 deletions

View file

@ -50,7 +50,7 @@ public:
u32 get_char_from_character_map(KeyEvent) const;
void set_client(KeyboardClient* client) { m_client = client; }
void set_client(KeyboardClient* client);
void set_maps(NonnullOwnPtr<KString> character_map_name, Keyboard::CharacterMapData const& character_map);
private:
@ -63,6 +63,7 @@ private:
KeyboardClient* m_client { nullptr };
RefPtr<I8042Controller> m_i8042_controller;
NonnullRefPtrVector<HIDDevice> m_hid_devices;
Spinlock m_client_lock;
};
class KeyboardClient {