]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/sockgtk.cpp
Virtualize wxSocketImpl creation by routing it via wxSocketManager.
[wxWidgets.git] / src / gtk1 / sockgtk.cpp
index ae2225a6a12a1c2954efc07b9b2adc997fa7bd3b..c8d449cfd86638627b813b39f108f03d8ed3614c 100644 (file)
@@ -28,10 +28,19 @@ void wxSocket_GDK_Input(gpointer data,
                         gint WXUNUSED(source),
                         GdkInputCondition condition)
 {
                         gint WXUNUSED(source),
                         GdkInputCondition condition)
 {
-    wxFDIOHandler * const handler = static_cast<wxFDIOHandler *>(data);
+    wxSocketImplUnix * const handler = static_cast<wxSocketImplUnix *>(data);
 
     if ( condition & GDK_INPUT_READ )
 
     if ( condition & GDK_INPUT_READ )
+    {
         handler->OnReadWaiting();
         handler->OnReadWaiting();
+
+        // 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 )
+            return;
+    }
+
     if ( condition & GDK_INPUT_WRITE )
         handler->OnWriteWaiting();
 }
     if ( condition & GDK_INPUT_WRITE )
         handler->OnWriteWaiting();
 }
@@ -40,7 +49,7 @@ void wxSocket_GDK_Input(gpointer data,
 class GTKSocketManager : public wxSocketInputBasedManager
 {
 public:
 class GTKSocketManager : public wxSocketInputBasedManager
 {
 public:
-    virtual int AddInput(wxFDIOHandler *handler, int fd, SocketDir d)
+    virtual int AddInput(wxSocketImplUnix *handler, int fd, SocketDir d)
     {
         return gdk_input_add
                (
     {
         return gdk_input_add
                (