diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2012-08-21 23:02:52 +0100 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2012-08-21 23:02:52 +0100 |
commit | eee30723d7bc86bf874ee87be06136b11ab2de6a (patch) | |
tree | 67ab4961705782516ea077120801d6621e783f5f /docview/components | |
parent | c9e914e4f5a51d1b712755507ca6ae1b571428b6 (diff) | |
download | fpGUI-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/components')
-rw-r--r-- | docview/components/richtext/RichTextStyleUnit.pas | 6 |
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; |