From eee30723d7bc86bf874ee87be06136b11ab2de6a Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Tue, 21 Aug 2012 23:02:52 +0100 Subject: docview: fixes a memory leak in font handling. We checked for the same fontdesc, but never for the same instance. So the NewFont instance might not have been freed, causing the memory leak. --- docview/components/richtext/RichTextStyleUnit.pas | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'docview/components') diff --git a/docview/components/richtext/RichTextStyleUnit.pas b/docview/components/richtext/RichTextStyleUnit.pas index 70813b32..cf5e8a7e 100644 --- a/docview/components/richtext/RichTextStyleUnit.pas +++ b/docview/components/richtext/RichTextStyleUnit.pas @@ -462,7 +462,11 @@ begin NewFont := fpgApplication.DefaultFont; if FontSame( NewFont, AFont ) then - exit; // no change + begin + if AFont <> NewFont then { they are not the same instance } + NewFont.Free; + Exit; // no change needed + end; AFont.Free; AFont := NewFont; -- cgit v1.2.3-70-g09d2