diff --git a/src/osgDB/Registry.cpp b/src/osgDB/Registry.cpp index 3cfef076f..fbfc3b34c 100644 --- a/src/osgDB/Registry.cpp +++ b/src/osgDB/Registry.cpp @@ -1813,7 +1813,8 @@ void Registry::removeExpiredObjectsInCache(double expiryTime) oitr!=_objectCache.end(); ++oitr) { - if (oitr->second.second<=expiryTime) + if (oitr->second.second<=expiryTime && + oitr->second.first->referenceCount()<=1) { // record the filename of the entry to use as key for deleting // afterwards/