aboutsummaryrefslogtreecommitdiff
path: root/src/unstable/cachebase.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2013-07-18 02:09:29 +0000
committerMike Buland <eichlan@xagasoft.com>2013-07-18 02:09:29 +0000
commit51eef132bb2bb67e658756eaebeae5e52c13de98 (patch)
treef99d9e36ab2b3bbcb26d106cd0a71a03f27a8eb5 /src/unstable/cachebase.h
parent65cc54be0a14e627938731ff8deefea61c2c1cfa (diff)
downloadlibbu++-51eef132bb2bb67e658756eaebeae5e52c13de98.tar.gz
libbu++-51eef132bb2bb67e658756eaebeae5e52c13de98.tar.bz2
libbu++-51eef132bb2bb67e658756eaebeae5e52c13de98.tar.xz
libbu++-51eef132bb2bb67e658756eaebeae5e52c13de98.zip
Fixed caching changed issue. The cache now marks objects as unchanged for you
after they are saved. It needs some more testing, but the theory is sound.
Diffstat (limited to 'src/unstable/cachebase.h')
-rw-r--r--src/unstable/cachebase.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/unstable/cachebase.h b/src/unstable/cachebase.h
index 6cc3e77..af2884c 100644
--- a/src/unstable/cachebase.h
+++ b/src/unstable/cachebase.h
@@ -184,7 +184,8 @@ namespace Bu
184 pEnt( rhs.pEnt ), 184 pEnt( rhs.pEnt ),
185 pData( rhs.pData ) 185 pData( rhs.pData )
186 { 186 {
187 pEnt->incRef(); 187 if( pEnt )
188 pEnt->incRef();
188 } 189 }
189 190
190 virtual ~CachePtr() 191 virtual ~CachePtr()
@@ -228,7 +229,8 @@ namespace Bu
228 kId = rhs.kId; 229 kId = rhs.kId;
229 pEnt = rhs.pEnt; 230 pEnt = rhs.pEnt;
230 pData = rhs.pData; 231 pData = rhs.pData;
231 pEnt->incRef(); 232 if( pEnt )
233 pEnt->incRef();
232 234
233 return *this; 235 return *this;
234 } 236 }
@@ -513,6 +515,7 @@ namespace Bu
513 Entry *pEnt = hCacheEntry.get( i.getKey() ); 515 Entry *pEnt = hCacheEntry.get( i.getKey() );
514 Bu::MutexLocker ml( pEnt->getMutex() ); 516 Bu::MutexLocker ml( pEnt->getMutex() );
515 _save( pEnt->getPtr() ); 517 _save( pEnt->getPtr() );
518 pEnt->getPtr()->changed( false );
516 } 519 }
517 hChanged.clear(); 520 hChanged.clear();
518 } 521 }