]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/thread.cpp
Fix another crash when conversion fails in Unix PostScript code.
[wxWidgets.git] / src / os2 / thread.cpp
index d1ee5dc364a051a7a0b29c2ab7698cd04d3da9e9..94bff21e7c633faa8b618cf4d986b419ed3475d1 100644 (file)
@@ -4,7 +4,6 @@
 // Author:      Original from Wolfram Gloger/Guilhem Lavaux/David Webster
 // Modified by: Stefan Neis
 // Created:     04/22/98
-// RCS-ID:      $Id$
 // Copyright:   (c) Stefan Neis (2003)
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -354,7 +353,7 @@ public:
     {
         m_hThread = 0;
         m_eState = STATE_NEW;
-        m_nPriority = WXTHREAD_DEFAULT_PRIORITY;
+        m_nPriority = wxPRIORITY_DEFAULT;
     }
 
     ~wxThreadInternal()
@@ -497,7 +496,7 @@ bool wxThreadInternal::Create( wxThread* pThread,
         return false;
     }
     m_hThread = tid;
-    if (m_nPriority != WXTHREAD_DEFAULT_PRIORITY)
+    if (m_nPriority != wxPRIORITY_DEFAULT)
     {
         SetPriority(m_nPriority);
     }
@@ -626,6 +625,14 @@ wxThreadError wxThread::Run()
 {
     wxCriticalSectionLocker         lock((wxCriticalSection &)m_critsect);
 
+    // Create the thread if it wasn't created yet with an explicit
+    // Create() call:
+    if ( !m_internal->GetHandle() )
+    {
+        if ( !m_internal->Create(this, 0) )
+            return wxTHREAD_NO_RESOURCE;
+    }
+
     if ( m_internal->GetState() != STATE_NEW )
     {
         // actually, it may be almost any state at all, not only STATE_RUNNING