diff --git a/src/dlangui/graphics/gldrawbuf.d b/src/dlangui/graphics/gldrawbuf.d index e73bd2f0..d4fd2c5f 100644 --- a/src/dlangui/graphics/gldrawbuf.d +++ b/src/dlangui/graphics/gldrawbuf.d @@ -305,6 +305,13 @@ void initGLCaches() { glGlyphCache = new GLGlyphCache; } +void destroyGLCaches() { + if (glImageCache) + destroy(glImageCache); + if (glGlyphCache) + destroy(glGlyphCache); +} + private abstract class GLCache { static class GLCacheItem diff --git a/src/dlangui/platforms/common/startup.d b/src/dlangui/platforms/common/startup.d index 62dfd378..d85c0d78 100644 --- a/src/dlangui/platforms/common/startup.d +++ b/src/dlangui/platforms/common/startup.d @@ -386,6 +386,10 @@ extern (C) void releaseResourcesOnAppExit() { imageCache = null; } FontManager.instance = null; + static if (ENABLE_OPENGL) { + import dlangui.graphics.gldrawbuf; + destroyGLCaches(); + } debug { if (DrawBuf.instanceCount > 0) {