From 7dc3b34bfd0521d4e551272b65caa812ea6bcb4d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 22 Jul 2014 16:02:33 +0000 Subject: [PATCH] Removed State::AppliedProgramObjectSet container and Obsever usage from osg::State to address threading bug crash. The State::AppliedProgramObjectSet wasn't ever being used actively in the current rev of the OSG so populating and clearing was no longer neccessary, allowing the code to be removed completely. git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14377 16af8721-9629-0410-8352-f15c8da7e697 --- CMakeLists.txt | 2 +- include/osg/State | 13 +------------ include/osg/Version | 2 +- src/osg/State.cpp | 40 --------------------------------------- src/osgUtil/SceneView.cpp | 4 ---- 5 files changed, 3 insertions(+), 58 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7f85e264..0cf1f8b6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ PROJECT(OpenSceneGraph) SET(OPENSCENEGRAPH_MAJOR_VERSION 3) SET(OPENSCENEGRAPH_MINOR_VERSION 3) SET(OPENSCENEGRAPH_PATCH_VERSION 3) -SET(OPENSCENEGRAPH_SOVERSION 113) +SET(OPENSCENEGRAPH_SOVERSION 114) # set to 0 when not a release candidate, non zero means that any generated # svn tags will be treated as release candidates of given number diff --git a/include/osg/State b/include/osg/State index 6e4b15da1..280c6fbbe 100644 --- a/include/osg/State +++ b/include/osg/State @@ -112,7 +112,7 @@ class VertexAttribAlias * which typically stall the graphics pipeline (see, for instance, * \c captureCurrentState() and \c getModelViewMatrix()). */ -class OSG_EXPORT State : public Referenced, public Observer +class OSG_EXPORT State : public Referenced { public : @@ -214,7 +214,6 @@ class OSG_EXPORT State : public Referenced, public Observer /** reset the state object to an empty stack.*/ void reset(); - inline const Viewport* getCurrentViewport() const { return static_cast(getLastAppliedAttribute(osg::StateAttribute::VIEWPORT)); @@ -1329,11 +1328,6 @@ class OSG_EXPORT State : public Referenced, public Observer if (_lastAppliedProgramObject!=program) { _lastAppliedProgramObject = program; - if (program && _appliedProgramObjectSet.count(program)==0) - { - _appliedProgramObjectSet.insert(program); - program->addObserver(this); - } } } inline const Program::PerContextProgram* getLastAppliedProgramObject() const { return _lastAppliedProgramObject; } @@ -1463,8 +1457,6 @@ class OSG_EXPORT State : public Referenced, public Observer /** Initialize extension used by osg:::State.*/ void initializeExtensionProcs(); - virtual void objectDeleted(void* object); - /** Get the GL adapter object used to map OpenGL 1.0 glBegin/glEnd usage to vertex arrays.*/ inline GLBeginEndAdapter& getGLBeginEndAdapter() { return _glBeginEndAdapter; } @@ -1574,8 +1566,6 @@ class OSG_EXPORT State : public Referenced, public Observer typedef std::vector > MatrixStack; - typedef std::set AppliedProgramObjectSet; - inline const ModeMap& getModeMap() const {return _modeMap;}; inline const AttributeMap& getAttributeMap() const {return _attributeMap;}; inline const UniformMap& getUniformMap() const {return _uniformMap;}; @@ -1788,7 +1778,6 @@ class OSG_EXPORT State : public Referenced, public Observer TextureModeMapList _textureModeMapList; TextureAttributeMapList _textureAttributeMapList; - AppliedProgramObjectSet _appliedProgramObjectSet; const Program::PerContextProgram* _lastAppliedProgramObject; StateSetStack _stateStateStack; diff --git a/include/osg/Version b/include/osg/Version index 42d3fa6e1..23e5cf641 100644 --- a/include/osg/Version +++ b/include/osg/Version @@ -21,7 +21,7 @@ extern "C" { #define OPENSCENEGRAPH_MAJOR_VERSION 3 #define OPENSCENEGRAPH_MINOR_VERSION 3 #define OPENSCENEGRAPH_PATCH_VERSION 3 -#define OPENSCENEGRAPH_SOVERSION 113 +#define OPENSCENEGRAPH_SOVERSION 114 /* Convenience macro that can be used to decide whether a feature is present or not i.e. * #if OSG_MIN_VERSION_REQUIRED(2,9,5) diff --git a/src/osg/State.cpp b/src/osg/State.cpp index c7891eb84..0ee23fa12 100644 --- a/src/osg/State.cpp +++ b/src/osg/State.cpp @@ -134,28 +134,8 @@ State::~State() //_texCoordArrayList.clear(); //_vertexAttribArrayList.clear(); - - // OSG_NOTICE<<"State::~State()"<removeObserver(this); - } } -void State::objectDeleted(void* object) -{ - const Program::PerContextProgram* ppcp = reinterpret_cast(object); - AppliedProgramObjectSet::iterator itr = _appliedProgramObjectSet.find(ppcp); - if (itr != _appliedProgramObjectSet.end()) - { - // OSG_NOTICE<<"Removing _appliedProgramObjectSet entry "<resetAppliedUniforms(); - (*apitr)->removeObserver(this); - } - - _appliedProgramObjectSet.clear(); - - // what about uniforms??? need to clear them too... // go through all active Unfirom's, setting to change to force update, // the idea is to leave only the global defaults left. @@ -1767,14 +1735,6 @@ void State::print(std::ostream& fout) const } fout<<"}"<releaseGLObjects(_renderInfo.getState()); - - // we need to reset State as it keeps handles to Program objects. - if (_renderInfo.getState()) _renderInfo.getState()->reset(); } - void SceneView::flushAllDeletedGLObjects() { _requiresFlush = false;