From b4f8ebcb496ca231fa737307a0f9757d01e37c7b Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sat, 1 May 2010 19:20:21 +0000 Subject: Cache fixes. --- src/cache.h | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'src/cache.h') diff --git a/src/cache.h b/src/cache.h index 1753407..896aa71 100644 --- a/src/cache.h +++ b/src/cache.h @@ -112,11 +112,6 @@ namespace Bu return pData != NULL; } - operator bool() const - { - return isBound() && isValid(); - } - const keytype &getKey() const { return kId; @@ -297,7 +292,7 @@ namespace Bu try { if( hEnt.get( cId ).iRefs > 0 ) { - printf("Shouldn't delete, references still exist!\n"); + printf("Shouldn't unload, references still exist!\n"); return; } } @@ -317,24 +312,22 @@ namespace Bu void erase( const keytype &cId ) { TRACE( cId ); - if( hEnt.has( cId ) ) - { - try { - if( hEnt.get( cId ).iRefs > 0 ) - { - printf("Shouldn't delete, references still exist!\n"); - return; - } - } - catch( Bu::HashException &e ) { - get( cId ); + try { + if( hEnt.get( cId ).iRefs > 0 ) + { + printf("Shouldn't erase, references still exist!\n"); + return; } - - pCalc->onUnload( hEnt.get( cId ).pData, cId ); - pStore->destroy( hEnt.get( cId ).pData, cId ); + } + catch( Bu::HashException &e ) { + get( cId ); } + obtype *pObj = hEnt.get( cId ).pData; + pCalc->onDestroy( pObj, cId ); hEnt.erase( cId ); + + pStore->destroy( pObj, cId ); } typedef Bu::List KeyList; -- cgit v1.2.3