Added wxFDIOHandler::IsOk() and use it with wxSocketImplUnix.

This will allow to use the base wxFDIOHandler class only in GUI-specific
network code and this remove its dependency on wxSocketImplUnix. IOW it paves
the way for a proper solution of the problem fixed by r61336 without the hack
of r61335 which results in linking problems (which went undiscovered until now
but were, in fact, always present, i.e. r61335 couldn't work).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61685 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-08-17 23:02:18 +00:00
parent fc72fab6c6
commit 251e98cb73
4 changed files with 7 additions and 2 deletions

View File

@@ -26,6 +26,10 @@ public:
// called when there is exception on descriptor // called when there is exception on descriptor
virtual void OnExceptionWaiting() = 0; virtual void OnExceptionWaiting() = 0;
// called to check if the handler is still valid, only used by
// wxSocketImplUnix currently
virtual bool IsOk() const { return true; }
// virtual dtor for the base class // virtual dtor for the base class
virtual ~wxFDIOHandler() { } virtual ~wxFDIOHandler() { }
}; };

View File

@@ -52,6 +52,7 @@ public:
virtual void OnReadWaiting(); virtual void OnReadWaiting();
virtual void OnWriteWaiting(); virtual void OnWriteWaiting();
virtual void OnExceptionWaiting(); virtual void OnExceptionWaiting();
virtual bool IsOk() const { return m_fd != INVALID_SOCKET; }
// Unix-specific functions used by wxSocketFDIOManager only // Unix-specific functions used by wxSocketFDIOManager only
bool HasAnyEnabledCallbacks() const { return m_enabledCallbacks != 0; } bool HasAnyEnabledCallbacks() const { return m_enabledCallbacks != 0; }

View File

@@ -37,7 +37,7 @@ void wxSocket_GDK_Input(gpointer data,
// we could have lost connection while reading in which case we // we could have lost connection while reading in which case we
// shouldn't call OnWriteWaiting() as the socket is now closed and it // shouldn't call OnWriteWaiting() as the socket is now closed and it
// would assert // would assert
if ( handler->m_fd == INVALID_SOCKET ) if ( !handler->IsOk() )
return; return;
} }

View File

@@ -37,7 +37,7 @@ void wxSocket_GDK_Input(gpointer data,
// we could have lost connection while reading in which case we // we could have lost connection while reading in which case we
// shouldn't call OnWriteWaiting() as the socket is now closed and it // shouldn't call OnWriteWaiting() as the socket is now closed and it
// would assert // would assert
if ( handler->m_fd == INVALID_SOCKET ) if ( !handler->IsOk() )
return; return;
} }