diff --git a/src/osg/GraphicsContext.cpp b/src/osg/GraphicsContext.cpp index 5476fb564..5385e8bd9 100644 --- a/src/osg/GraphicsContext.cpp +++ b/src/osg/GraphicsContext.cpp @@ -304,9 +304,9 @@ void GraphicsContext::incrementContextIDUsageCount(unsigned int contextID) { OpenThreads::ScopedLock lock(s_contextIDMapMutex); - OSG_INFO<<"GraphicsContext::incrementContextIDUsageCount("<getContextID()); + osg::deleteAllGLObjects(_state->getContextID()); - OSG_INFO<<"Done delete of GL objects"<getContextID()); + } _state->reset(); @@ -561,7 +570,7 @@ void GraphicsContext::close(bool callCloseImplementation) // now discard any deleted deleted OpenGL objects that the are still hanging around - such as due to // the the flushDelete*() methods not being invoked, such as when using GraphicContextEmbedded where makeCurrent // does not work. - if (_state.valid()) + if ( !sharedContextExists && _state.valid()) { OSG_INFO<<"Doing discard of deleted OpenGL objects."<