From Jannik Heller , GL object deletion fix.

"This submission changes deleteGLObject calls to scheduleGLObjectForDeletion, to ensure that the actual deletion happens from the correct thread (the graphics thread). This fixes the leak I reported in http://forum.openscenegraph.org/viewtopic.php?t=15567 , and possibly also http://forum.openscenegraph.org/viewtopic.php?t=15564."
This commit is contained in:
Robert Osfield
2016-02-05 20:29:22 +00:00
parent 8cefa05e3a
commit 3e0435febd
5 changed files with 12 additions and 12 deletions

View File

@@ -67,7 +67,7 @@ void FragmentProgram::dirtyFragmentProgramObject()
{
if (_fragmentProgramIDList[i] != 0)
{
osg::get<GLFragmentProgramManager>(i)->deleteGLObject(_fragmentProgramIDList[i]);
osg::get<GLFragmentProgramManager>(i)->scheduleGLObjectForDeletion(_fragmentProgramIDList[i]);
_fragmentProgramIDList[i] = 0;
}
}
@@ -157,7 +157,7 @@ void FragmentProgram::releaseGLObjects(State* state) const
unsigned int contextID = state->getContextID();
if (_fragmentProgramIDList[contextID] != 0)
{
osg::get<GLFragmentProgramManager>(contextID)->deleteGLObject(_fragmentProgramIDList[contextID]);
osg::get<GLFragmentProgramManager>(contextID)->scheduleGLObjectForDeletion(_fragmentProgramIDList[contextID]);
_fragmentProgramIDList[contextID] = 0;
}
}