X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a3cf8dca335f4a364a84c6144d4747c2429575a4..ff55f8377ba8965bee36d1221501a3868da952e9:/src/msw/gsockmsw.cpp?ds=sidebyside diff --git a/src/msw/gsockmsw.cpp b/src/msw/gsockmsw.cpp index 489feff570..3ca8b48349 100644 --- a/src/msw/gsockmsw.cpp +++ b/src/msw/gsockmsw.cpp @@ -313,10 +313,10 @@ void GSocketMSWManager::Destroy_Socket(GSocket *socket) { /* Remove the socket from the list */ EnterCriticalSection(&critical); - if ( socket->IsOk() ) - { - const int msgnum = socket->m_msgnumber; + const int msgnum = socket->m_msgnumber; + if ( msgnum ) + { // we need to remove any pending messages for this socket to avoid having // them sent to a new socket which could reuse the same message number as // soon as we destroy this one @@ -326,6 +326,7 @@ void GSocketMSWManager::Destroy_Socket(GSocket *socket) socketList[msgnum - WM_USER] = NULL; } + //else: the socket has never been created successfully LeaveCriticalSection(&critical); } @@ -366,7 +367,7 @@ LRESULT CALLBACK _GSocket_Internal_WinProc(HWND hWnd, * destroyed) and for safety, check that the m_fd field * is what we expect it to be. */ - if ((socket != NULL) && (socket->m_fd == wParam)) + if ((socket != NULL) && ((WPARAM)socket->m_fd == wParam)) { switch WSAGETSELECTEVENT(lParam) {