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
This commit is contained in:
Vadim Zeitlin
2011-02-19 14:26:50 +00:00
parent ec44cec559
commit e1c51d7eb9

View File

@@ -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;