]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/thread.cpp
Fixed mouse handling for captured windows
[wxWidgets.git] / src / msw / thread.cpp
index 7a42d2e60e0fceddac1372020a5fef241877f7ad..f7e9f0517b6b3791b9b6aca14f01baed0871dd6b 100644 (file)
@@ -62,7 +62,7 @@
 #if defined(__VISUALC__) || \
     (defined(__BORLANDC__) && (__BORLANDC__ >= 0x500)) || \
     (defined(__GNUG__) && defined(__MSVCRT__)) || \
-    defined(__WATCOMC__)
+    defined(__WATCOMC__) || defined(__MWERKS__)
 
     #undef wxUSE_BEGIN_THREAD
     #define wxUSE_BEGIN_THREAD
@@ -371,6 +371,8 @@ private:
     wxMutex& m_mutex;
 
     wxSemaphore m_semaphore;
+
+    DECLARE_NO_COPY_CLASS(wxConditionInternal)
 };
 
 wxConditionInternal::wxConditionInternal(wxMutex& mutex)
@@ -1135,12 +1137,18 @@ wxThreadError wxThread::Delete(ExitCode *pRc)
         }
     }
 
-    if ( !::GetExitCodeThread(hThread, (LPDWORD)&rc) )
+    // although the thread might be already in the EXITED state it might not
+    // have terminated yet and so we are not sure that it has actually
+    // terminated if the "if" above hadn't been taken
+    do
     {
-        wxLogLastError(wxT("GetExitCodeThread"));
+        if ( !::GetExitCodeThread(hThread, (LPDWORD)&rc) )
+        {
+            wxLogLastError(wxT("GetExitCodeThread"));
 
-        rc = (ExitCode)-1;
-    }
+            rc = (ExitCode)-1;
+        }
+    } while ( (DWORD)rc == STILL_ACTIVE );
 
     if ( IsDetached() )
     {
@@ -1151,9 +1159,6 @@ wxThreadError wxThread::Delete(ExitCode *pRc)
         delete this;
     }
 
-    wxASSERT_MSG( (DWORD)rc != STILL_ACTIVE,
-                  wxT("thread must be already terminated.") );
-
     if ( pRc )
         *pRc = rc;