diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 43cabb5f51..88f8d0d237 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,19 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-01-09 15:10 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/compiler/hbusage.c + * update the year in hb_compPrintLogo() from 2006 to 2007 + + * harbour/source/vm/garbage.c + ! fixed potentially very serious bug - when I added array items + references I forgot to update GC. Fortunately it was caught + by code to detect bugs in object destructors so only RT error + was reported instead of internal HVM memory corruption + + * harbour/tests/hbinline.prg + * updated comments + 2007-01-09 10:56 UTC+0200 Chen Kedem * doc/whatsnew.txt + Add changes for the new beta build. diff --git a/harbour/source/compiler/hbusage.c b/harbour/source/compiler/hbusage.c index 64d0b4eaaa..ef32914461 100644 --- a/harbour/source/compiler/hbusage.c +++ b/harbour/source/compiler/hbusage.c @@ -192,6 +192,6 @@ void hb_compPrintLogo( void ) char * szVer = hb_verHarbour(); printf( "%s\n", szVer ); - printf( "Copyright 1999-2006, http://www.harbour-project.org/\n" ); + printf( "Copyright 1999-2007, http://www.harbour-project.org/\n" ); hb_xfree( szVer ); } diff --git a/harbour/source/vm/garbage.c b/harbour/source/vm/garbage.c index 0dfeb36012..8934e84845 100644 --- a/harbour/source/vm/garbage.c +++ b/harbour/source/vm/garbage.c @@ -381,8 +381,31 @@ void * hb_gcUnlock( void * pBlock ) */ void hb_gcItemRef( HB_ITEM_PTR pItem ) { - if( HB_IS_BYREF( pItem ) ) - pItem = hb_itemUnRef( pItem ); + while( HB_IS_BYREF( pItem ) ) + { + if( HB_IS_ENUM( pItem ) ) + return; + else if( ! HB_IS_MEMVAR( pItem ) && + pItem->item.asRefer.offset == 0 && + pItem->item.asRefer.value >= 0 ) + { + /* array item reference */ + HB_GARBAGE_PTR pAlloc = HB_GC_PTR( pItem->item.asRefer.BasePtr.array ); + if( pAlloc->used == s_uUsedFlag ) + { + ULONG ulSize = pItem->item.asRefer.BasePtr.array->ulLen; + pAlloc->used ^= HB_GC_USED_FLAG; + pItem = pItem->item.asRefer.BasePtr.array->pItems; + while( ulSize ) + { + hb_gcItemRef( pItem++ ); + --ulSize; + } + } + return; + } + pItem = hb_itemUnRefOnce( pItem ); + } if( HB_IS_ARRAY( pItem ) ) { diff --git a/harbour/tests/hbinline.prg b/harbour/tests/hbinline.prg index 1d6cd958ac..a452d19484 100644 --- a/harbour/tests/hbinline.prg +++ b/harbour/tests/hbinline.prg @@ -4,8 +4,7 @@ /* * Harbour Project source code: - * new Hb_inLine{} test - * compile it using -kcI Harbour compiler switch + * new Hb_inLine {} test * * Copyright 2006 Przemyslaw Czerpak * www - http://www.harbour-project.org @@ -15,7 +14,7 @@ proc main() local hb_inLine := " (var) " -? hb_inLine{ hb_retc("inLine"); } + hb_inLine(" parameter ") { +? hb_inLine { hb_retc("inLine"); } + hb_inLine(" parameter ") { hb_retc( hb_parc( 1 ) ); } + "!" + hb_inLine + hb_inLine() { hb_retc( ":-)" ); } + ; hb_inLine() + "{}"