diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 8dda824c65..44f1e7b715 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,16 @@ +2000-06-25 23:58 UTC+0100 Ryszard Glab + + *source/vm/garbage.c + *fixed deallocation of the last memory block - it should cure + GPF's + + *source/rtl/errorapi.c + *fixed call for hb_itemInit() + + *tests/onidle.prg + *commented self-referencing codeblock since it requires some + more work + 2000-06-25 21:52 UTC+0100 Victor Szakats * source/lang/Makefile diff --git a/harbour/source/rtl/errorapi.c b/harbour/source/rtl/errorapi.c index 13e55a0726..c52eaba5bc 100644 --- a/harbour/source/rtl/errorapi.c +++ b/harbour/source/rtl/errorapi.c @@ -149,7 +149,7 @@ void hb_errInit( void ) * NOTE: hb_itemClear() cannot be used to initialize an item because * memory occupied by the item can contain garbage bits */ - hb_itemInit( &s_errorBlock.type ); + hb_itemInit( &s_errorBlock ); } void hb_errExit( void ) diff --git a/harbour/source/rtl/idle.c b/harbour/source/rtl/idle.c index 09b5fb4bc1..3d095ade82 100644 --- a/harbour/source/rtl/idle.c +++ b/harbour/source/rtl/idle.c @@ -59,6 +59,8 @@ static HB_ITEM_PTR s_pIdleTasks = NULL; static USHORT s_uiIdleTask = 0; /* number of tasks in the list */ static USHORT s_uiIdleMaxTask = 0; +/* flag to prevent recursive calls of hb_idleState() */ +static BOOL s_bIamIdle = FALSE; static void hb_releaseCPU( void ) { @@ -101,14 +103,19 @@ static void hb_releaseCPU( void ) /* performs all tasks defined for idle state */ void hb_idleState( void ) { - hb_releaseCPU(); - hb_gcCollect(); - - if( s_pIdleTasks ) + if( ! s_bIamIdle ) { - hb_vmEvalBlock( s_pIdleTasks + s_uiIdleTask ); - if( ++s_uiIdleTask == s_uiIdleMaxTask ) - s_uiIdleTask = 0; + s_bIamIdle = TRUE; + hb_releaseCPU(); + hb_gcCollect(); + + if( s_pIdleTasks ) + { + hb_vmEvalBlock( s_pIdleTasks + s_uiIdleTask ); + if( ++s_uiIdleTask == s_uiIdleMaxTask ) + s_uiIdleTask = 0; + } + s_bIamIdle = FALSE; } } diff --git a/harbour/source/vm/garbage.c b/harbour/source/vm/garbage.c index a854f82a50..91ee572817 100644 --- a/harbour/source/vm/garbage.c +++ b/harbour/source/vm/garbage.c @@ -110,7 +110,7 @@ void hb_gcFree( void *pBlock ) pAlloc->pNext->pPrev = pAlloc->pPrev; if( s_pCurrBlock == pAlloc ) s_pCurrBlock = pAlloc->pNext; - if( pAlloc->pNext == pAlloc->pPrev ) + if( pAlloc->pPrev == pAlloc->pPrev && pAlloc == s_pCurrBlock ) s_pCurrBlock = NULL; /* this was the last block */ HB_GARBAGE_FREE( pAlloc ); } diff --git a/harbour/tests/onidle.prg b/harbour/tests/onidle.prg index c216fc1d77..bf3c7f1884 100644 --- a/harbour/tests/onidle.prg +++ b/harbour/tests/onidle.prg @@ -21,7 +21,7 @@ LOCAL nPrev:=SECONDS() nH3 = HB_IDLEADD( {|| DEVPOS(0,41), IIF(n=4,n:=1,n++),DEVOUT(aSign[n]) } ) nH4 = HB_IDLEADD( {|| DEVPOS(0,61), DEVOUT( 1000*(SECONDS()-nPrev) ), nPrev:=SECONDS()} ) - INKEY( 10 ) + INKEY( 5 ) HB_IDLEDEL( nH3 ) HB_IDLEDEL( nH2 ) HB_IDLEDEL( nH1 ) @@ -40,7 +40,7 @@ LOCAL cb b[1] :=b b[2] :=a - cb := {|x| IIF( x>10, IIF(x=0,0,EVAL(cb,x-1)), DEVOUT(x))} +// cb := {|x| IIF( x>10, IIF(x=0,0,EVAL(cb,x-1)), DEVOUT(x))} // EVAL( cb, 20 ) // INKEY( .5 )