From f0dff024feb1b16e992a84e9c076a0336fdd0bc6 Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 26 Apr 2013 09:12:05 +1000 Subject: Release all cached fonts when finalising. --- gtk/PlatGTK.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gtk') diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index c228047c6..d244b2525 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -259,6 +259,7 @@ class FontCached : Font { public: static FontID FindOrCreate(const FontParameters &fp); static void ReleaseId(FontID fid_); + static void ReleaseAll(); }; FontCached *FontCached::first = 0; @@ -328,6 +329,12 @@ void FontCached::ReleaseId(FontID fid_) { FontMutexUnlock(); } +void FontCached::ReleaseAll() { + while (first) { + ReleaseId(first->GetID()); + } +} + FontID FontCached::CreateNewFont(const FontParameters &fp) { PangoFontDescription *pfd = pango_font_description_new(); if (pfd) { @@ -2165,5 +2172,6 @@ void Platform_Initialise() { } void Platform_Finalise() { + FontCached::ReleaseAll(); FontMutexFree(); } -- cgit v1.2.3