Fixed thread sample SEGV on wxGTK

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3493 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Guilhem Lavaux
1999-08-26 17:35:00 +00:00
parent 3372145d9d
commit 9baf15cea6
2 changed files with 8 additions and 6 deletions

View File

@@ -402,12 +402,16 @@ void MyFrame::OnIdle(wxIdleEvent &event)
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) )
{ {
size_t count = m_threads.Count(); size_t count = m_threads.Count();
m_critsect.Enter();
for ( size_t i = 0; i < count; i++ ) for ( size_t i = 0; i < count; i++ )
{ {
wxThread *thread = m_threads[0];
m_threads.Remove(thread);
// We must always use 0 because Delete() calls OnThreadExit() and // We must always use 0 because Delete() calls OnThreadExit() and
// OnThreadExit() removed 0 from the array. // OnThreadExit() removes 0 from the array.
m_threads[0]->Delete(); thread->Delete();
} }
m_critsect.Leave();
Close(TRUE); Close(TRUE);
} }
@@ -430,7 +434,4 @@ void MyFrame::OnClear(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnThreadExit(wxThread *thread) void MyFrame::OnThreadExit(wxThread *thread)
{ {
wxCriticalSectionLocker enter(m_critsect);
m_threads.Remove(thread);
} }

View File

@@ -23,7 +23,8 @@ enum {
typedef enum { typedef enum {
wxSOUND_NOFORMAT, wxSOUND_NOFORMAT,
wxSOUND_PCM, wxSOUND_PCM,
wxSOUND_ULAW wxSOUND_ULAW,
wxSOUND_G72X
} wxSoundFormatType; } wxSoundFormatType;
typedef enum { typedef enum {