summaryrefslogtreecommitdiffstats
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-03-08 14:10:45 +0100
committerStephan Bergmann <sbergman@redhat.com>2012-03-08 14:11:56 +0100
commitd5cb0636dc902f069307a44181ce5bb14932c0f9 (patch)
treee397ea2180aecc30250fe94d1eb4dc69bc484cc9 /sal
parentfix the condition (diff)
downloadcore-d5cb0636dc902f069307a44181ce5bb14932c0f9.tar.gz
core-d5cb0636dc902f069307a44181ce5bb14932c0f9.zip
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.
Diffstat (limited to 'sal')
-rw-r--r--sal/inc/osl/thread.hxx13
1 files changed, 6 insertions, 7 deletions
diff --git a/sal/inc/osl/thread.hxx b/sal/inc/osl/thread.hxx
index 0bade3b06c86..ddb9d918e96e 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()