diff --git a/include/wx/private/fdiodispatcher.h b/include/wx/private/fdiodispatcher.h index f37e0217a4..bc372926dd 100644 --- a/include/wx/private/fdiodispatcher.h +++ b/include/wx/private/fdiodispatcher.h @@ -26,6 +26,10 @@ public: // called when there is exception on descriptor 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 ~wxFDIOHandler() { } }; diff --git a/include/wx/unix/private/sockunix.h b/include/wx/unix/private/sockunix.h index a5832a9443..4b8f80afe3 100644 --- a/include/wx/unix/private/sockunix.h +++ b/include/wx/unix/private/sockunix.h @@ -52,6 +52,7 @@ public: virtual void OnReadWaiting(); virtual void OnWriteWaiting(); virtual void OnExceptionWaiting(); + virtual bool IsOk() const { return m_fd != INVALID_SOCKET; } // Unix-specific functions used by wxSocketFDIOManager only bool HasAnyEnabledCallbacks() const { return m_enabledCallbacks != 0; } diff --git a/src/gtk/sockgtk.cpp b/src/gtk/sockgtk.cpp index c8d449cfd8..7c0ed5c27d 100644 --- a/src/gtk/sockgtk.cpp +++ b/src/gtk/sockgtk.cpp @@ -37,7 +37,7 @@ void wxSocket_GDK_Input(gpointer data, // we could have lost connection while reading in which case we // shouldn't call OnWriteWaiting() as the socket is now closed and it // would assert - if ( handler->m_fd == INVALID_SOCKET ) + if ( !handler->IsOk() ) return; } diff --git a/src/gtk1/sockgtk.cpp b/src/gtk1/sockgtk.cpp index c8d449cfd8..7c0ed5c27d 100644 --- a/src/gtk1/sockgtk.cpp +++ b/src/gtk1/sockgtk.cpp @@ -37,7 +37,7 @@ void wxSocket_GDK_Input(gpointer data, // we could have lost connection while reading in which case we // shouldn't call OnWriteWaiting() as the socket is now closed and it // would assert - if ( handler->m_fd == INVALID_SOCKET ) + if ( !handler->IsOk() ) return; }