* 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

@@ -37,7 +37,7 @@ static pthread_t p_mainid;
static wxMutex p_list_mutex;
static wxList p_threads_list;
wxMutex wxMainMutex; // controls access to all GUI functions
wxMutex *wxMainMutex; // controls access to all GUI functions
/////////////////////////////////////////////////////////////////////////////
// GUI thread manager
@@ -288,10 +288,10 @@ void *wxThread::Join()
wxYield();
if (do_unlock)
wxMainMutex.Unlock();
wxMainMutex->Unlock();
pthread_join(p_internal->thread_id, &status);
if (do_unlock)
wxMainMutex.Lock();
wxMainMutex->Lock();
p_list_mutex.Lock();
delete p_threads_list.Nth(p_internal->id);
@@ -377,17 +377,19 @@ class wxThreadModule : public wxModule {
DECLARE_DYNAMIC_CLASS(wxThreadModule)
public:
virtual bool OnInit() {
wxMainMutex = new wxMutex();
wxThreadGuiInit();
p_mainid = pthread_self();
p_threads_list = wxList(wxKEY_INTEGER);
wxMainMutex.Lock();
wxMainMutex->Lock();
return TRUE;
}
virtual void OnExit() {
wxMainMutex.Unlock();
wxMainMutex->Unlock();
wxThreadGuiExit();
delete wxMainMutex;
}
};