From f149974c09f0cd87810f575a2cdbd929a246769e Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Tue, 11 May 2021 18:22:07 -0400 Subject: [PATCH] Never free the default font in a destructor as it is a shared resource --- simpledisplay.d | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/simpledisplay.d b/simpledisplay.d index a05a3cd..d0c783d 100644 --- a/simpledisplay.d +++ b/simpledisplay.d @@ -7674,9 +7674,9 @@ class OperatingSystemFont { } } - if(font) + if(font && font !is ScreenPainterImplementation.defaultfont) XFreeFont(display, font); - if(fontset) + if(fontset && fontset !is ScreenPainterImplementation.defaultfontset) XFreeFontSet(display, fontset); font = null; @@ -11053,12 +11053,14 @@ version(X11) { xftDraw = null; } - version(none) // we don't want to free it because we can use it later - if(font) + if(font && font !is defaultfont) { XFreeFont(display, font); - version(none) // we don't want to free it because we can use it later - if(fontset) + font = null; + } + if(fontset && fontset !is defaultfontset) { XFreeFontSet(display, fontset); + fontset = null; + } XFlush(display); if(window.paintingFinishedDg !is null)