wxConnectionBase *wxTCPClient::OnMakeConnection()
{
- return new wxTCPConnection;
+ return new wxTCPConnection();
}
// --------------------------------------------------------------------------
wxDELETE(m_codeco);
wxDELETE(m_sockstrm);
- if (m_sock) m_sock->Destroy();
+ if (m_sock)
+ {
+ m_sock->SetClientData(NULL);
+ m_sock->Destroy();
+ }
}
void wxTCPConnection::Compress(bool WXUNUSED(on))
wxSocketNotify evt = event.GetSocketEvent();
wxTCPConnection *connection = (wxTCPConnection *)(event.GetClientData());
+ // This socket is being deleted; skip this event
+ if (!connection)
+ return;
+
int msg = 0;
wxDataInputStream *codeci;
wxDataOutputStream *codeco;
wxString topic_name = connection->m_topic;
wxString item;
- // The socket handler signals us that we lost the connection: destroy all.
+ // We lost the connection: destroy everything
if (evt == wxSOCKET_LOST)
{
sock->Notify(FALSE);
wxSocketServer *server = (wxSocketServer *) event.GetSocket();
wxTCPServer *ipcserv = (wxTCPServer *) event.GetClientData();
+ // This socket is being deleted; skip this event
+ if (!ipcserv)
+ return;
+
if (event.GetSocketEvent() != wxSOCKET_CONNECTION)
return;