From 1ca3ea4b2797de1edaa6b0c6f64f28090c80319e Mon Sep 17 00:00:00 2001 From: gazer Date: Thu, 8 Jun 2017 02:22:15 +0300 Subject: [PATCH] get rid from 'Non-zero DrawBuf instance count when exiting: 1' message --- src/dlangui/graphics/gldrawbuf.d | 7 +++++++ src/dlangui/platforms/common/startup.d | 4 ++++ 2 files changed, 11 insertions(+) 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) {