From acd86c6f027540c3b3e89a02a6ccb14d2d9b2528 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Fri, 26 Sep 2008 00:42:41 +0000 Subject: [PATCH] 2008-09-26 02:42 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/vm/thread.c ! fixed thread cleanup code when startthread() fails, f.e. OS refuse to create new thread. --- harbour/ChangeLog | 5 +++++ harbour/source/vm/thread.c | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6ccfa473c4..013ffefa48 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,11 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-09-26 02:42 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/vm/thread.c + ! fixed thread cleanup code when startthread() fails, f.e. + OS refuse to create new thread. + 2008-09-25 21:50 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * include/hbdefs.h ! Fixed 64-bit printf() formatting strings to be compatible diff --git a/harbour/source/vm/thread.c b/harbour/source/vm/thread.c index e7905e61ae..5c3ae5e97f 100644 --- a/harbour/source/vm/thread.c +++ b/harbour/source/vm/thread.c @@ -431,6 +431,12 @@ static HB_GARBAGE_FUNC( hb_threadDestructor ) hb_itemRelease( pThread->pResult ); pThread->pResult = NULL; } + if( pThread->pSet ) + { + hb_setRelease( pThread->pSet ); + hb_xfree( pThread->pSet ); + pThread->pSet = NULL; + } if( pThread->th_id != 0 ) { hb_threadDetach( pThread->th_id ); @@ -622,10 +628,6 @@ HB_FUNC( HB_THREADSTART ) pThread->th_id = hb_threadCreate( hb_threadStartVM, ( void * ) pReturn ); if( pThread->th_id == 0 ) { - if( pThread->pMemvars ) - hb_itemRelease( pThread->pMemvars ); - hb_setRelease( pThread->pSet ); - hb_xfree( pThread->pSet ); hb_itemRelease( pReturn ); hb_ret(); }