From 3bda4587355b1bad7388aa72672c79448fb40bab Mon Sep 17 00:00:00 2001 From: Tom Date: Sun, 29 Nov 2020 17:09:14 -0700 Subject: [PATCH] Kernel: Lock should keep a reference to whoever holds the lock Fixes a crash reported in #3990 --- Kernel/Lock.h | 2 +- Kernel/Scheduler.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel/Lock.h b/Kernel/Lock.h index b3d589e139..5d27ff936f 100644 --- a/Kernel/Lock.h +++ b/Kernel/Lock.h @@ -72,7 +72,7 @@ private: // the lock is unlocked, it just means we don't know which threads hold it. // When locked exclusively, this is always the one thread that holds the // lock. - Thread* m_holder { nullptr }; + RefPtr m_holder; }; class Locker { diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp index 27cf61dd51..20ef1e6810 100644 --- a/Kernel/Scheduler.cpp +++ b/Kernel/Scheduler.cpp @@ -311,7 +311,7 @@ bool Scheduler::donate_to(RefPtr& beneficiary, const char* reason) ASSERT(!proc.in_irq()); if (proc.in_critical() > 1) { - scheduler_data.m_pending_beneficiary = *beneficiary; // Save the beneficiary + scheduler_data.m_pending_beneficiary = beneficiary; // Save the beneficiary scheduler_data.m_pending_donate_reason = reason; proc.invoke_scheduler_async(); return false;