]> git.saurik.com Git - wxWidgets.git/blobdiff - src/qt/threadpsx.cpp
added wxUSE_NOTEBOOK to include/wx/msw/setup0.h, removed wxUSE_RADIOBUTTON (we
[wxWidgets.git] / src / qt / threadpsx.cpp
index 9704e70e2544dc5a5e462147d31cf78297182373..2d4912c05a32cd4b4d73b2e94867c8a081ba277d 100644 (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
@@ -180,11 +180,6 @@ void *wxThreadInternal::PthreadStart(void *ptr)
   pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
   void* status = thread->Entry();
 
-  // Delete the current thread from the list
-  p_list_mutex.Lock();
-  delete node_thread;
-  p_list_mutex.Unlock();
-
   thread->Exit(status);
 
   return NULL;
@@ -293,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);
@@ -382,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;
   }
 };