diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 343bc21f95..a426bd33aa 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,8 @@ +2000-07-07 10:30 UTC+0100 Ryszard Glab + + *source/vm/garbage.c + * fixed possible endless loop during the garbage collecting + 2000-07-06 14:10 GMT+0100 Ignacio Ortiz * source/rtl/tget.prg * Fixed minor bugs in numbers with decimals and when clause @E was used with numbers diff --git a/harbour/source/vm/garbage.c b/harbour/source/vm/garbage.c index 54d092bfae..abdfb51b96 100644 --- a/harbour/source/vm/garbage.c +++ b/harbour/source/vm/garbage.c @@ -54,6 +54,7 @@ typedef struct HB_GARBAGE_ #define HB_GC_UNLOCKED 0 #define HB_GC_LOCKED 1 /* do not collect a memory block */ #define HB_GC_NOTCHECKED 2 /* this item was not checked yet */ +#define HB_GC_CHECKING 4 /* this item is checked currently */ /* pointer to memory block that will be checked in next step */ static HB_GARBAGE_PTR s_pCurrBlock = NULL; @@ -266,16 +267,23 @@ BOOL hb_gcItemRef( HB_ITEM_PTR pItem, void *pBlock ) return TRUE; else { + HB_GARBAGE_PTR pAlloc = ( HB_GARBAGE_PTR ) pItem->item.asArray.value; ULONG ulSize = pItem->item.asArray.value->ulLen; - pItem = pItem->item.asArray.value->pItems; + --pAlloc; + pAlloc->status |= HB_GC_CHECKING; + pItem = pItem->item.asArray.value->pItems; while( ulSize-- ) { if( hb_gcItemRef( pItem, pBlock ) ) + { + pAlloc->status &= ~( (ULONG) ( HB_GC_CHECKING ) ); return TRUE; + } else ++pItem; } + pAlloc->status &= ~( (ULONG) ( HB_GC_CHECKING ) ); } } else if( HB_IS_BLOCK( pItem ) )