From 567ad293fdf4f5d58d2520d0b0c8fbc0080bccef Mon Sep 17 00:00:00 2001 From: bzzt Date: Wed, 20 Feb 2019 13:37:00 +0000 Subject: [PATCH] Don't discard object cache with uninitialized timestamp This can happen during terrain loading --- components/resource/objectcache.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/resource/objectcache.cpp b/components/resource/objectcache.cpp index e8c082f91b..ffe150c74e 100644 --- a/components/resource/objectcache.cpp +++ b/components/resource/objectcache.cpp @@ -75,10 +75,11 @@ void ObjectCache::updateTimeStampOfObjectsInCacheWithExternalReferences(double r itr!=_objectCache.end(); ++itr) { - // if ref count is greater the 1 the object has an external reference. - if (itr->second.first->referenceCount()>1) + // If ref count is greater than 1, the object has an external reference. + // If the timestamp is yet to be initialized, it needs to be updated too. + if (itr->second.first->referenceCount()>1 || itr->second.second == 0.0) { - // so update it time stamp. + // So update it. itr->second.second = referenceTime; } }