Added reset of the State::CurrentVertexArrayState() to prevent the State::_vas becoming a dangling pointer when VertexArrayState objects are deleted.

This commit is contained in:
Robert Osfield
2019-01-21 17:36:40 +00:00
parent 6455159757
commit 488b4854b2
3 changed files with 16 additions and 2 deletions

View File

@@ -549,6 +549,9 @@ class OSG_EXPORT State : public Referenced
/** Set the getCurrentVertexArrayState to the GlobalVertexArrayState.*/
void setCurrentToGlobalVertexArrayState() { _vas = _globalVertexArrayState.get(); }
/** Reset the CurrentVertexArrayObject if it's value equals the specificied vas - use when deleting a vas.*/
void resetCurrentVertexArrayStateOnMatch(VertexArrayState* vas) { if (_vas==vas) _vas = 0; }
/** disable the vertex, normal, color, tex coords, secondary color, fog coord and index arrays.*/
void disableAllVertexArrays();

View File

@@ -182,10 +182,12 @@ class OSG_EXPORT VertexArrayState : public osg::Referenced
public:
virtual ~VertexArrayState();
// osg::GLBufferObject* getGLBufferObject(osg::Array* array);
osg::State* _state;
osg::ref_ptr<ObserverSet> _stateObserverSet;
osg::ref_ptr<osg::GLExtensions> _ext;
bool _isVertexBufferObjectSupported;