Explorar el Código

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 hace 4 años
padre
commit
0a94b4233f
Se han modificado 1 ficheros con 5 adiciones y 6 borrados
  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;
 }