From 0a94b4233f86da44c384657a297cdbe9164d029c Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sat, 1 May 2021 22:53:58 +0200 Subject: [PATCH] Kernel: Don't use ref_count() in MasterPTY::close() With the recent fixes to how close() gets called this is not necessary anymore. --- Kernel/TTY/MasterPTY.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Kernel/TTY/MasterPTY.cpp b/Kernel/TTY/MasterPTY.cpp index 42a80baf58..6a82964bea 100644 --- a/Kernel/TTY/MasterPTY.cpp +++ b/Kernel/TTY/MasterPTY.cpp @@ -94,14 +94,13 @@ bool MasterPTY::can_write_from_slave() const KResult MasterPTY::close() { - if (ref_count() == 2) { - InterruptDisabler disabler; - // After the closing FileDescription dies, slave is the only thing keeping me alive. - // From this point, let's consider ourselves closed. - m_closed = true; + InterruptDisabler disabler; + // After the closing FileDescription dies, slave is the only thing keeping me alive. + // From this point, let's consider ourselves closed. + m_closed = true; + if (m_slave) m_slave->hang_up(); - } return KSuccess; }