Fixed crash the occurred when passing in a osgDB::Options to the ObjectCache that doesn't have any references to it.

This commit is contained in:
Robert Osfield
2018-05-11 09:00:22 +01:00
parent 0fc7aa8cc0
commit fcde92ad89
2 changed files with 27 additions and 6 deletions

View File

@@ -70,14 +70,17 @@ class OSGDB_EXPORT ObjectCache : public osg::Referenced
typedef std::pair<std::string, osg::ref_ptr<const osgDB::Options> > FileNameOptionsPair;
class ClassComp {
public:
struct ClassComp
{
bool operator() (const ObjectCache::FileNameOptionsPair& lhs, const ObjectCache::FileNameOptionsPair& rhs) const;
};
typedef std::pair<osg::ref_ptr<osg::Object>, double > ObjectTimeStampPair;
typedef std::map<FileNameOptionsPair, ObjectTimeStampPair, ClassComp> ObjectCacheMap;
ObjectCacheMap::iterator find(const std::string& fileName, const osgDB::Options* options);
ObjectCacheMap _objectCache;
OpenThreads::Mutex _objectCacheMutex;