浏览代码

Kernel: Don't use ref_count() in MasterPTY::close()

With the recent fixes to how close() gets called this is not
necessary anymore.
Gunnar Beutner 4 年之前
父节点
当前提交
0a94b4233f
共有 1 个文件被更改,包括 5 次插入6 次删除
  1. 5 6
      Kernel/TTY/MasterPTY.cpp

+ 5 - 6
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;
 }