From 37bfc36601c5355e3dbac53c23c735d9c089eb54 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 4 Apr 2023 15:35:32 +0200 Subject: [PATCH] Kernel: Make SlavePTY store pointer to MasterPTY as NonnullRefPtr No need for LockRefPtr here, as the pointer never changes after initialization. --- Kernel/TTY/SlavePTY.cpp | 4 ++-- Kernel/TTY/SlavePTY.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Kernel/TTY/SlavePTY.cpp b/Kernel/TTY/SlavePTY.cpp index e2b0921d51..7d8550df3b 100644 --- a/Kernel/TTY/SlavePTY.cpp +++ b/Kernel/TTY/SlavePTY.cpp @@ -35,9 +35,9 @@ bool SlavePTY::unref() const return did_hit_zero; } -SlavePTY::SlavePTY(MasterPTY& master, unsigned index) +SlavePTY::SlavePTY(NonnullRefPtr master, unsigned index) : TTY(201, index) - , m_master(master) + , m_master(move(master)) , m_index(index) { auto& process = Process::current(); diff --git a/Kernel/TTY/SlavePTY.h b/Kernel/TTY/SlavePTY.h index 585c2f11a2..7161fc9082 100644 --- a/Kernel/TTY/SlavePTY.h +++ b/Kernel/TTY/SlavePTY.h @@ -42,9 +42,9 @@ private: virtual ErrorOr close() override; friend class MasterPTY; - SlavePTY(MasterPTY&, unsigned index); + SlavePTY(NonnullRefPtr, unsigned index); - LockRefPtr m_master; + NonnullRefPtr const m_master; time_t m_time_of_last_write { 0 }; unsigned m_index { 0 };