From f7c44a6a163799b19c234b9b9362afa50bbf5bbf Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Feb 1999 23:24:50 +0000 Subject: [PATCH] wxCritSection change to accomodate mem checking system (even better :-) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1772 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/thread.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index 8028e928e1..3ee7c1149a 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -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; } // ----------------------------------------------------------------------------