]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/thread.cpp
Added dummy OnIdle to wxWindow in wxGTK; doc tweaks
[wxWidgets.git] / src / msw / thread.cpp
index 8028e928e1dee979a0dbc5850a227ac5743d418d..3ee7c1149a9843ad07efe9f1f23f218a3f4463b6 100644 (file)
@@ -262,8 +262,7 @@ wxCriticalSection::wxCriticalSection()
 
 wxCriticalSection::~wxCriticalSection()
 {
-    if ( m_critsect )
-        delete m_critsect;
+    wxASSERT_MSG( !m_critsect, "Forgot to Leave() critical section" );
 }
 
 void wxCriticalSection::Enter()
@@ -278,6 +277,9 @@ void wxCriticalSection::Leave()
     wxCHECK_RET( m_critsect, "Leave() without matching Enter()" );
 
     ::LeaveCriticalSection(*m_critsect);
+
+    delete m_critsect;
+    m_critsect = NULL;
 }
 
 // ----------------------------------------------------------------------------