X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7725dc7c0a1daf8116f5d3f2bcf45557a3e7443f..1aa7b427f21877287adfb49395a209459320c044:/src/mac/corefoundation/gsockosx.cpp diff --git a/src/mac/corefoundation/gsockosx.cpp b/src/mac/corefoundation/gsockosx.cpp index 52e9323347..9e057ad1f4 100644 --- a/src/mac/corefoundation/gsockosx.cpp +++ b/src/mac/corefoundation/gsockosx.cpp @@ -39,7 +39,14 @@ void Mac_Socket_Callback(CFSocketRef s, CFSocketCallBackType callbackType, { case kCFSocketConnectCallBack: assert(!socket->m_server); - socket->Detected_Write(); + // KH: If data is non-NULL, the connect failed, do not call Detected_Write, + // which will only end up creating a spurious connect event because the + // call to getsocketopt SO_ERROR inexplicably returns no error. + // The change in behavior cannot be traced to any particular commit or + // timeframe so I'm not sure what to think, but after so many hours, + // this seems to address the issue and it's time to move on. + if (data == NULL) + socket->Detected_Write(); break; case kCFSocketReadCallBack: socket->Detected_Read(); @@ -123,7 +130,10 @@ void GSocketGUIFunctionsTableConcrete::Destroy_Socket(GSocket *socket) struct MacGSocketData *data = (struct MacGSocketData*)(socket->m_gui_dependent); if (data) { - CFRelease(data->socket); + if ( data->source ) + CFRelease(data->source); + if ( data->socket ) + CFRelease(data->socket); free(data); } }