From e1c51d7eb9a2f145ba6e4f1cd947a09aee82db69 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 19 Feb 2011 14:26:50 +0000 Subject: [PATCH] Work around an intermittent crash in GSocket under Mac. The socket descriptor may somehow be invalid when an input timeout notification is received. This is almost certainly not the right fix but the code has completely changed in 2.9 so it doesn't make much sense to spend time on fixing it properly here. But adding this check seems to be enough to fix the crash, see #12264. Closes #8904. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@66976 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/unix/gsocket.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/unix/gsocket.cpp b/src/unix/gsocket.cpp index 468e222a85..ebd3b2254b 100644 --- a/src/unix/gsocket.cpp +++ b/src/unix/gsocket.cpp @@ -1533,6 +1533,15 @@ void GSocket::Disable(GSocketEvent event) */ GSocketError GSocket::Input_Timeout() { +#ifdef __WXMAC__ + // This seems to happen under OS X sometimes, see #8904. + if ( m_fd == INVALID_SOCKET ) + { + m_error = GSOCK_TIMEDOUT; + return GSOCK_TIMEDOUT; + } +#endif // __WXMAC__ + struct timeval tv; fd_set readfds; int ret;