summaryrefslogtreecommitdiff
path: root/src/unstable/cachebase.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2014-08-08 21:18:15 +0000
committerMike Buland <eichlan@xagasoft.com>2014-08-08 21:18:15 +0000
commitcece4c165f0d19b2fe23cdf367a4e6bba63c4a6e (patch)
treecbfb6736a102b62fa3228f086c9f201f0e78ba5b /src/unstable/cachebase.h
parent21a4337dc2f969dc3ec81e6ba3170119bcb67016 (diff)
downloadlibbu++-cece4c165f0d19b2fe23cdf367a4e6bba63c4a6e.tar.gz
libbu++-cece4c165f0d19b2fe23cdf367a4e6bba63c4a6e.tar.bz2
libbu++-cece4c165f0d19b2fe23cdf367a4e6bba63c4a6e.tar.xz
libbu++-cece4c165f0d19b2fe23cdf367a4e6bba63c4a6e.zip
The cache didn't handle syncing objects that were marked changed and then
deleted before the sync could occur properly. They are now ignored during sync.
Diffstat (limited to 'src/unstable/cachebase.h')
-rw-r--r--src/unstable/cachebase.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/unstable/cachebase.h b/src/unstable/cachebase.h
index b17d377..3db257b 100644
--- a/src/unstable/cachebase.h
+++ b/src/unstable/cachebase.h
@@ -595,10 +595,24 @@ namespace Bu
595 { 595 {
596 for( typename CacheKeySet::iterator i = hChanged.begin(); i; i++ ) 596 for( typename CacheKeySet::iterator i = hChanged.begin(); i; i++ )
597 { 597 {
598 Entry *pEnt = hCacheEntry.get( i.getKey() ); 598 Entry *pEnt = NULL;
599 Bu::MutexLocker ml( pEnt->getMutex() ); 599 try
600 _save( pEnt->getPtr() ); 600 {
601 pEnt->getPtr()->changed( false ); 601 pEnt = hCacheEntry.get( i.getKey() );
602 }
603 catch( Bu::HashException )
604 {
605 // The entry wasn't there, most likely because it
606 // was deleted. That's ok.
607 }
608 // This isn't inside of the above because we want to be
609 // able to handle these exceptions differently.
610 if( pEnt )
611 {
612 Bu::MutexLocker ml( pEnt->getMutex() );
613 _save( pEnt->getPtr() );
614 pEnt->getPtr()->changed( false );
615 }
602 } 616 }
603 hChanged.clear(); 617 hChanged.clear();
604 } 618 }