[Libreoffice-commits] .: sal/inc

Stephan Bergmann sbergmann at kemper.freedesktop.org
Thu Mar 8 05:13:30 PST 2012


 sal/inc/osl/thread.hxx |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

New commits:
commit d5cb0636dc902f069307a44181ce5bb14932c0f9
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 8 14:10:45 2012 +0100

    In osl::Thread::create, do not access members after starting the thread
    
    ...as the Thread may already have been destroyed by that time.
    Also, no need to programmatically check fro programming errors when they
    have already been addressed by assert.

diff --git a/sal/inc/osl/thread.hxx b/sal/inc/osl/thread.hxx
index 0bade3b..ddb9d91 100644
--- a/sal/inc/osl/thread.hxx
+++ b/sal/inc/osl/thread.hxx
@@ -81,14 +81,13 @@ public:
     sal_Bool SAL_CALL create()
     {
         assert(m_hThread == 0); // only one running thread per instance
-           if (m_hThread)
-            return sal_False;
-
         m_hThread = osl_createSuspendedThread( threadFunc, (void*)this);
-        if ( m_hThread )
-            osl_resumeThread(m_hThread);
-
-        return m_hThread != 0;
+        if (m_hThread == 0)
+        {
+            return false;
+        }
+        osl_resumeThread(m_hThread);
+        return true;
     }
 
     sal_Bool SAL_CALL createSuspended()


More information about the Libreoffice-commits mailing list