Merged GLExtension deletion mechanism from master to avoid GLEXtension being deleted when shared contexts are used and osg::State is deleted when a context is deleted.

This commit is contained in:
Robert Osfield 2017-07-25 15:58:27 +01:00
parent 224f837e0d
commit b37b635a7c

View File

@ -139,8 +139,12 @@ State::~State()
// delete the GLExtensions object associated with this osg::State.
if (_glExtensions)
{
GLExtensions::Set(_contextID, 0);
_glExtensions = 0;
GLExtensions* glExtensions = GLExtensions::Get(_contextID, false);
if (glExtensions && glExtensions->referenceCount() == 1) {
// the only reference left to the extension is in the static map itself, so we clean it up now
GLExtensions::Set(_contextID, 0);
}
}
//_texCoordArrayList.clear();