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:
Vadim Zeitlin
2009-07-21 14:16:44 +00:00
parent 2388960a08
commit 3185abc278
8 changed files with 203 additions and 129 deletions

View File

@@ -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();
}