Support delayed destruction in console applications too.\n\nThis only works if there is a running event loop but if there is one, we can have the same kind of problems with non-GUI objects such as sockets in console applications as we have with windows in GUI ones, so we must support this (see #10989).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61488 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -695,6 +695,11 @@ void wxTCPEventHandler::HandleDisconnect(wxTCPConnection *connection)
|
||||
connection->m_sock->Notify(false);
|
||||
connection->m_sock->Close();
|
||||
|
||||
// don't leave references to this soon-to-be-dangling connection in the
|
||||
// socket as it won't be destroyed immediately as its destruction will be
|
||||
// delayed in case there are more events pending for it
|
||||
connection->m_sock->SetClientData(NULL);
|
||||
|
||||
connection->SetConnected(false);
|
||||
connection->OnDisconnect();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user