diff --git a/include/osgDB/DatabasePager b/include/osgDB/DatabasePager index d6eb751ad..099de9f0a 100644 --- a/include/osgDB/DatabasePager +++ b/include/osgDB/DatabasePager @@ -350,6 +350,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl { DatabaseRequest(): osg::Referenced(true), + _valid(false), _frameNumberFirstRequest(0), _timestampFirstRequest(0.0), _priorityFirstRequest(0.f), @@ -359,7 +360,12 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl _numOfRequests(0), _requestQueue(0) {} - + + void invalidate(); + + bool valid() const { return _valid; } + + bool _valid; std::string _fileName; int _frameNumberFirstRequest; double _timestampFirstRequest; @@ -371,7 +377,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl osg::observer_ptr _groupForAddingLoadedSubgraph; osg::ref_ptr _loadedModel; DataToCompileMap _dataToCompileMap; - osg::ref_ptr _loadOptions; + osg::ref_ptr _loadOptions; RequestQueue* _requestQueue; bool isRequestCurrent (int frameNumber) const @@ -382,12 +388,16 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl struct RequestQueue : public osg::Referenced { + public: typedef std::vector< osg::ref_ptr > RequestList; void sort(); - + RequestList _requestList; OpenThreads::Mutex _requestMutex; + + protected: + virtual ~RequestQueue(); }; diff --git a/src/osgDB/DatabasePager.cpp b/src/osgDB/DatabasePager.cpp index 28da47b74..89362a785 100644 --- a/src/osgDB/DatabasePager.cpp +++ b/src/osgDB/DatabasePager.cpp @@ -279,8 +279,30 @@ struct DatabasePager::SortFileRequestFunctor ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// // -// ReadQueue +// RequestQueue // +void DatabasePager::DatabaseRequest::invalidate() +{ + osg::notify(osg::INFO)<<" DatabasePager::DatabaseRequest::invalidate()."<invalidate(); + } +} + void DatabasePager::RequestQueue::sort() { std::sort(_requestList.begin(),_requestList.end(),SortFileRequestFunctor()); @@ -1295,6 +1317,12 @@ void DatabasePager::requestNodeFile(const std::string& fileName,osg::Group* grou if (databaseRequestRef.valid()) { DatabaseRequest* databaseRequest = dynamic_cast(databaseRequestRef.get()); + if (databaseRequest && databaseRequest->valid()) + { + osg::notify(osg::NOTICE)<<"DatabaseRequest has been previously invalidated whilst still attached to scene graph."<