summaryrefslogtreecommitdiff
path: root/docview
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2012-08-21 23:02:52 +0100
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2012-08-21 23:02:52 +0100
commiteee30723d7bc86bf874ee87be06136b11ab2de6a (patch)
tree67ab4961705782516ea077120801d6621e783f5f /docview
parentc9e914e4f5a51d1b712755507ca6ae1b571428b6 (diff)
downloadfpGUI-eee30723d7bc86bf874ee87be06136b11ab2de6a.tar.xz
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.
Diffstat (limited to 'docview')
-rw-r--r--docview/components/richtext/RichTextStyleUnit.pas6
1 files changed, 5 insertions, 1 deletions
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;