]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/gsockmsw.cpp
use iterator in wxTextBuffer::Translate() instead of c_str()
[wxWidgets.git] / src / msw / gsockmsw.cpp
index a1ada1918bceac633f96a474fbe5c618d7184244..79969ac301e8b3a776ca764bd99875bb357d3ca7 100644 (file)
@@ -311,7 +311,19 @@ void GSocketMSWManager::Destroy_Socket(GSocket *socket)
   /* Remove the socket from the list */
   EnterCriticalSection(&critical);
   if ( socket->IsOk() )
-      socketList[(socket->m_msgnumber - WM_USER)] = NULL;
+  {
+      const int msgnum = socket->m_msgnumber;
+
+      // we need to remove any pending messages for this socket to avoid having
+      // them sent to a new socket which could reuse the same message number as
+      // soon as we destroy this one
+      MSG msg;
+      while ( ::PeekMessage(&msg, hWin, msgnum, msgnum, PM_REMOVE) )
+          ;
+
+      socketList[msgnum - WM_USER] = NULL;
+  }
+
   LeaveCriticalSection(&critical);
 }