mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:48:10 +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:
parent
b8493bf70f
commit
cd08c4a5aa
3 changed files with 14 additions and 3 deletions
|
@ -254,8 +254,12 @@ void KeyboardDevice::key_state_changed(u8 scan_code, bool pressed)
|
|||
|
||||
if (pressed)
|
||||
event.flags |= Is_Press;
|
||||
if (HIDManagement::the().m_client)
|
||||
HIDManagement::the().m_client->on_key_pressed(event);
|
||||
|
||||
{
|
||||
SpinlockLocker locker(HIDManagement::the().m_client_lock);
|
||||
if (HIDManagement::the().m_client)
|
||||
HIDManagement::the().m_client->on_key_pressed(event);
|
||||
}
|
||||
|
||||
{
|
||||
SpinlockLocker lock(m_queue_lock);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue