From 51eef132bb2bb67e658756eaebeae5e52c13de98 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 18 Jul 2013 02:09:29 +0000 Subject: 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. --- src/unstable/cachebase.h | 7 +++++-- src/unstable/uuid.cpp | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/unstable') 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 pEnt( rhs.pEnt ), pData( rhs.pData ) { - pEnt->incRef(); + if( pEnt ) + pEnt->incRef(); } virtual ~CachePtr() @@ -228,7 +229,8 @@ namespace Bu kId = rhs.kId; pEnt = rhs.pEnt; pData = rhs.pData; - pEnt->incRef(); + if( pEnt ) + pEnt->incRef(); return *this; } @@ -513,6 +515,7 @@ namespace Bu Entry *pEnt = hCacheEntry.get( i.getKey() ); Bu::MutexLocker ml( pEnt->getMutex() ); _save( pEnt->getPtr() ); + pEnt->getPtr()->changed( false ); } hChanged.clear(); } diff --git a/src/unstable/uuid.cpp b/src/unstable/uuid.cpp index a93f713..304ea4a 100644 --- a/src/unstable/uuid.cpp +++ b/src/unstable/uuid.cpp @@ -77,6 +77,7 @@ int Bu::Uuid::getVersion() void Bu::Uuid::clear() { + memset( data, 0, 16 ); data[7] = msb(0); } -- cgit v1.2.3