Forráskód Böngészése

CHttpJob: Shutting down the job should actually destroy the socket

It's pretty confusing when a CObject is owned both by its parent-child
relationship, but also by an ObjectPtr member in the parent.
In those cases, we have to make sure we both unparent the child *and*
reove it from the ObjectPtr.

This will become a bit less confusing when ObjectPtr becomes RefPtr,
although still not crystal clear. I'm not sure what the solution is.
Andreas Kling 5 éve
szülő
commit
4d8455156e
1 módosított fájl, 2 hozzáadás és 0 törlés
  1. 2 0
      Libraries/LibCore/CHttpJob.cpp

+ 2 - 0
Libraries/LibCore/CHttpJob.cpp

@@ -134,5 +134,7 @@ void CHttpJob::shutdown()
         return;
         return;
     m_socket->on_ready_to_read = nullptr;
     m_socket->on_ready_to_read = nullptr;
     m_socket->on_connected = nullptr;
     m_socket->on_connected = nullptr;
+    remove_child(*m_socket);
     m_socket = nullptr;
     m_socket = nullptr;
 }
 }
+