From d30f1c2019a5c10321aca0e3e01a12f04fb4be22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 4 Feb 2018 14:13:47 +0100 Subject: [PATCH] Fix another Qt memory leak --- ext/native/gfx_es2/draw_text_qt.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/native/gfx_es2/draw_text_qt.cpp b/ext/native/gfx_es2/draw_text_qt.cpp index 7b523f47ab..7b6ca82561 100644 --- a/ext/native/gfx_es2/draw_text_qt.cpp +++ b/ext/native/gfx_es2/draw_text_qt.cpp @@ -140,6 +140,12 @@ void TextDrawerQt::ClearCache() { } cache_.clear(); sizeCache_.clear(); + // Also wipe the font map. + for (auto iter : fontMap_) { + delete iter.second; + } + fontMap_.clear(); + fontHash_ = 0; } void TextDrawerQt::DrawStringRect(DrawBuffer &target, const char *str, const Bounds &bounds, uint32_t color, int align) {