In Program::PerContextProgram changed const Uniform* to osg::ref_ptr<const Uniform*> to avoid the possibility of a uniform being deleted

and another being created and assigned at the same address which previously confused the uniform tracking code and introduced a bug.
This commit is contained in:
Robert Osfield 2008-06-19 11:58:34 +00:00
parent 174f9bbfe0
commit 061be3d084

View File

@ -188,7 +188,7 @@ class OSG_EXPORT Program : public osg::StateAttribute
if (location>=0)
{
if ((unsigned int)location>=_lastAppliedUniformList.size()) _lastAppliedUniformList.resize(location+1);
const Uniform* lastAppliedUniform = _lastAppliedUniformList[location].first;
const Uniform* lastAppliedUniform = _lastAppliedUniformList[location].first.get();
if (lastAppliedUniform != &uniform)
{
// new attribute
@ -241,7 +241,7 @@ class OSG_EXPORT Program : public osg::StateAttribute
ActiveVarInfoMap _uniformInfoMap;
ActiveVarInfoMap _attribInfoMap;
typedef std::pair<const osg::Uniform*, unsigned int> UniformModifiedCountPair;
typedef std::pair<osg::ref_ptr<const osg::Uniform>, unsigned int> UniformModifiedCountPair;
typedef std::vector<UniformModifiedCountPair> LastAppliedUniformList;
mutable LastAppliedUniformList _lastAppliedUniformList;