From 4cf49e8927ce2228d03d0934926bcb70d0965c72 Mon Sep 17 00:00:00 2001 From: Brian Hays Date: Wed, 20 Sep 2000 18:21:04 +0000 Subject: [PATCH] 2000-09-20 11:20 UTC+0800 Brian Hays --- harbour/ChangeLog | 9 +++++++++ harbour/doc/en/garbage.txt | 2 +- harbour/source/rdd/dbf1.c | 22 +++++++++++----------- harbour/source/rdd/workarea.c | 4 ++++ 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 4b64f52c63..3e8957fc05 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,12 @@ + source\rdd\dbf1.c + !removed reference to unknown pItem in HB_TRACE for hb_dbfUnlockAllRecords + doc/en/garbage.txt + minor grammar fixes + source/rdd/workarea.c + added Item lock/unlock to SetFilter/Clearfilter so GC won't + de-allocate the codeblock + (fixes error at close of app for a bad pointer in hb_xfree) + 2000-09-20 13:12 GMT+3 Alexander Kresin * source/rdd/workarea.c * include/hbrddwrk.h diff --git a/harbour/doc/en/garbage.txt b/harbour/doc/en/garbage.txt index c95686a254..95edf82acc 100644 --- a/harbour/doc/en/garbage.txt +++ b/harbour/doc/en/garbage.txt @@ -35,7 +35,7 @@ * doesn't know their location. This could cause some memory blocks to be * released prematurely. To prevent the premature deallocation of such memory * blocks they have to be locked for the garbage collector. The memory block - * can be locked with hb_gcLockItem() (recommendeed method) if + * can be locked with hb_gcLockItem() (recommended method) if * harbour item structure is used or hb_gcLock() function if a direct memory * pointer is used. The memory block can be unlocked by hb_gcUnlockItem() or * hb_gcUnlock(). diff --git a/harbour/source/rdd/dbf1.c b/harbour/source/rdd/dbf1.c index 8734462dbb..c52e29326f 100644 --- a/harbour/source/rdd/dbf1.c +++ b/harbour/source/rdd/dbf1.c @@ -262,7 +262,7 @@ static void hb_dbfUnlockAllRecords( DBFAREAP pArea ) { ULONG ulCount; - HB_TRACE(HB_TR_DEBUG, ("hb_dbfUnlockAllRecords(%p, %p)", pArea, pItem)); + HB_TRACE(HB_TR_DEBUG, ("hb_dbfUnlockAllRecords(%p, %p)", pArea )); if( pArea->pLocksPos ) { @@ -352,7 +352,7 @@ static ERRCODE hb_dbfLockRecord( DBFAREAP pArea, ULONG ulRecNo, BOOL * pResult, } else * pResult = FALSE; - return SUCCESS; + return SUCCESS; } /* @@ -492,7 +492,7 @@ static ULONG hb_dbfGetMemoLen( DBFAREAP pArea, USHORT uiIndex ) uiIndex = 0; while( uiIndex < DBT_BLOCKSIZE && pBlock[ uiIndex ] != 0x1A ) uiIndex++; - ulBlock += uiIndex; + ulBlock += uiIndex; } while( uiIndex == DBT_BLOCKSIZE ); return ulBlock; } @@ -1955,7 +1955,7 @@ ERRCODE hb_dbfPack( DBFAREAP pArea ) hb_vmPush( pBlock ); hb_vmDo( 0 ); } - + pArea->ulRecCount = ulRecOut; return hb_dbfGoTo( pArea, 1 ); } @@ -2243,17 +2243,17 @@ ERRCODE hb_dbfLock( DBFAREAP pArea, LPDBLOCKINFO pLockInfo ) switch( pLockInfo->uiMethod ) { case DBLM_EXCLUSIVE: - return hb_dbfLockRecord( pArea, pArea->ulRecNo, &pLockInfo->fResult, + return hb_dbfLockRecord( pArea, pArea->ulRecNo, &pLockInfo->fResult, ( pLockInfo->uiMethod == DBLM_EXCLUSIVE ) ); - + case DBLM_MULTIPLE: return hb_dbfLockRecord( pArea, hb_itemGetNL( pLockInfo->itmRecID ), - &pLockInfo->fResult, + &pLockInfo->fResult, ( pLockInfo->uiMethod == DBLM_EXCLUSIVE ) ); - + case DBLM_FILE: return hb_dbfLockFile( pArea, &pLockInfo->fResult ); - + default: pLockInfo->fResult = FALSE; } @@ -2484,11 +2484,11 @@ HB_FUNC( DBF_GETFUNCTABLE ) uiCount = ( USHORT * ) hb_itemGetPtr( hb_param( 1, HB_IT_POINTER ) ); * uiCount = RDDFUNCSCOUNT; pTable = ( RDDFUNCS * ) hb_itemGetPtr( hb_param( 2, HB_IT_POINTER ) ); - + HB_TRACE(HB_TR_DEBUG, ("DBF_GETFUNCTABLE(%i, %p)", uiCount, pTable)); if( pTable ) hb_retni( hb_rddInherit( pTable, &dbfTable, &dbfSuper, 0 ) ); else hb_retni( FAILURE ); -} \ No newline at end of file +} diff --git a/harbour/source/rdd/workarea.c b/harbour/source/rdd/workarea.c index c3fa39c052..cf951b05bb 100644 --- a/harbour/source/rdd/workarea.c +++ b/harbour/source/rdd/workarea.c @@ -737,6 +737,7 @@ ERRCODE hb_waClearFilter( AREAP pArea ) /* Free all items */ if( pArea->dbfi.itmCobExpr ) { + hb_gcUnlockItem(pArea->dbfi.itmCobExpr); hb_itemRelease( pArea->dbfi.itmCobExpr ); pArea->dbfi.itmCobExpr = NULL; } @@ -820,7 +821,10 @@ ERRCODE hb_waSetFilter( AREAP pArea, LPDBFILTERINFO pFilterInfo ) SELF_CLEARFILTER( pArea ); if( pFilterInfo->itmCobExpr ) + { pArea->dbfi.itmCobExpr = hb_itemNew( pFilterInfo->itmCobExpr ); + hb_gcLockItem(pArea->dbfi.itmCobExpr); + } if( pFilterInfo->abFilterText ) pArea->dbfi.abFilterText = hb_itemNew( pFilterInfo->abFilterText );