diff --git a/src/SFML/Graphics/RenderTextureImplFBO.cpp b/src/SFML/Graphics/RenderTextureImplFBO.cpp index 4a4f1f62e..c0debd794 100644 --- a/src/SFML/Graphics/RenderTextureImplFBO.cpp +++ b/src/SFML/Graphics/RenderTextureImplFBO.cpp @@ -60,12 +60,18 @@ namespace { sf::Uint64 contextId = sf::Context::getActiveContextId(); - for (std::set >::iterator iter = staleFrameBuffers.begin(); iter != staleFrameBuffers.end(); ++iter) + for (std::set >::iterator iter = staleFrameBuffers.begin(); iter != staleFrameBuffers.end();) { if (iter->first == contextId) { GLuint frameBuffer = static_cast(iter->second); glCheck(GLEXT_glDeleteFramebuffers(1, &frameBuffer)); + + staleFrameBuffers.erase(iter++); + } + else + { + ++iter; } } }