From 45f44897e3de7020e8161ebef212774f9080ebeb Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sun, 22 Aug 2010 13:45:56 +0200 Subject: docview: fixes the AV on exit. NOTE This is not a 100% fix, but rather a work-around. I need to still find out why such AV's occur. --- docview/components/richtext/CanvasFontManager.pas | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'docview') diff --git a/docview/components/richtext/CanvasFontManager.pas b/docview/components/richtext/CanvasFontManager.pas index 7996c16d..2994eece 100644 --- a/docview/components/richtext/CanvasFontManager.pas +++ b/docview/components/richtext/CanvasFontManager.pas @@ -567,10 +567,16 @@ destructor TCanvasFontManager.Destroy; FCanvas.Font := fpgApplication.DefaultFont; // delete each logical font and our record of it - for i := 0 to FLogicalFonts.Count - 1 do + for i := FLogicalFonts.Count-1 downto 0 do begin - lFont := TLogicalFont(FLogicalFonts[ i ]); - lFont.Free; + // TODO: This must be fixed. If we don't use try..except we sometimes get AV's on lFont.Free + // TODO: TLogicalFont must be totally removed from DocView. + try + lFont := TLogicalFont(FLogicalFonts[i]); + lFont.Free; + except + // do nothing + end; end; FLogicalFonts.Clear; FLogicalFonts.Free; -- cgit v1.2.3-54-g00ecf