]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/socket.cpp
don't call release() on non-owned buffer in wchar_t build (closes #10964); copy utf8_...
[wxWidgets.git] / src / common / socket.cpp
index 71cfcc6cce9d11dd35746b98bf5a942e49cacf95..032b8f094e08960a8738b816971175a4e337463f 100644 (file)
@@ -213,7 +213,11 @@ public:
     {
         m_socket->m_reading = false;
 
-        m_socket->m_impl->ReenableEvents(wxSOCKET_INPUT_FLAG);
+        // connection could have been lost while reading, in this case calling
+        // ReenableEvents() would assert and is not necessary anyhow
+        wxSocketImpl * const impl = m_socket->m_impl;
+        if ( impl && impl->m_fd != INVALID_SOCKET )
+            impl->ReenableEvents(wxSOCKET_INPUT_FLAG);
     }
 
 private:
@@ -231,13 +235,15 @@ public:
         wxASSERT_MSG( !m_socket->m_writing, "write reentrancy?" );
 
         m_socket->m_writing = true;
-
-        m_socket->m_impl->ReenableEvents(wxSOCKET_OUTPUT_FLAG);
     }
 
     ~wxSocketWriteGuard()
     {
         m_socket->m_writing = false;
+
+        wxSocketImpl * const impl = m_socket->m_impl;
+        if ( impl && impl->m_fd != INVALID_SOCKET )
+            impl->ReenableEvents(wxSOCKET_OUTPUT_FLAG);
     }
 
 private:
@@ -1620,7 +1626,9 @@ void wxSocketBase::OnRequest(wxSocketNotify notification)
         case wxSOCKET_LOST:
             flag = wxSOCKET_LOST_FLAG;
 
-            // if we lost the connection the socket is now closed
+            // if we lost the connection the socket is now closed and not
+            // connected any more
+            m_connected = false;
             m_closed = true;
             break;