From 3963f077fc4e36809eed33b65117315d9610e3aa Mon Sep 17 00:00:00 2001 From: erwin coumans Date: Thu, 4 Mar 2021 09:13:22 -0800 Subject: [PATCH] Fix memory leak in EGL / GUI mode, resetSimulation with textures in GUI mode. Fixes Issue #3285 --- examples/OpenGLWindow/GLInstancingRenderer.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/OpenGLWindow/GLInstancingRenderer.cpp b/examples/OpenGLWindow/GLInstancingRenderer.cpp index 3754c4a9e..81f9ec8c6 100644 --- a/examples/OpenGLWindow/GLInstancingRenderer.cpp +++ b/examples/OpenGLWindow/GLInstancingRenderer.cpp @@ -397,6 +397,15 @@ void GLInstancingRenderer::removeAllInstances() m_graphicsInstances.clear(); m_data->m_publicGraphicsInstances.exitHandles(); m_data->m_publicGraphicsInstances.initHandles(); + + for (int i=0;im_textureHandles.size();i++) + { + InternalTextureHandle& h = m_data->m_textureHandles[i]; + glDeleteTextures(1, &h.m_glTexture); + } + + m_data->m_textureHandles.clear(); + } GLInstancingRenderer::~GLInstancingRenderer()