* Fixed a memory leak in wxThread

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1033 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Guilhem Lavaux
1998-11-24 19:01:20 +00:00
parent 7be07660b4
commit 6773ae198f
14 changed files with 78 additions and 54 deletions

View File

@@ -34,7 +34,7 @@ enum thread_state {
/////////////////////////////////////////////////////////////////////////////
static int p_mainid;
wxMutex wxMainMutex;
wxMutex *wxMainMutex;
#include "threadgui.inc"
@@ -166,10 +166,10 @@ void *wxThread::Join()
int stat;
if (do_unlock)
wxMainMutex.Unlock();
wxMainMutex->Unlock();
waitpid(p_internal->thread_id, &stat, 0);
if (do_unlock)
wxMainMutex.Lock();
wxMainMutex->Lock();
if (!WIFEXITED(stat) && !WIFSIGNALED(stat))
return 0;
p_internal->state = STATE_IDLE;
@@ -238,14 +238,16 @@ class wxThreadModule : public wxModule {
DECLARE_DYNAMIC_CLASS(wxThreadModule)
public:
virtual bool OnInit() {
wxMainMutex = new wxMutex();
wxThreadGuiInit();
p_mainid = (int)getpid();
wxMainMutex.Lock();
wxMainMutex->Lock();
}
virtual void OnExit() {
wxMainMutex.Unlock();
wxMainMutex->Unlock();
wxThreadGuiExit();
delete wxMainMutex;
}
};