From da0eddc8e4f99134c113a6f249cc83cfb98bd1cf Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Sun, 13 Mar 2016 23:29:08 +0000 Subject: [PATCH] fpspreadsheet: Avoid orphaned tempory files if workbook Options contain boFileStream. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4549 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/fpspreadsheet/fpsxmlcommon.pas | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/fpspreadsheet/fpsxmlcommon.pas b/components/fpspreadsheet/fpsxmlcommon.pas index 4655a15f7..03a982bd1 100644 --- a/components/fpspreadsheet/fpsxmlcommon.pas +++ b/components/fpspreadsheet/fpsxmlcommon.pas @@ -352,9 +352,10 @@ begin if AStream is TFileStream then begin fn := TFileStream(AStream).Filename; - DeleteFile(fn); - end; - AStream.Free; + AStream.Free; // Destroy stream before deleting temp file! + DeleteFile(fn); // Otherwise the temp file will not be deleted. + end else + AStream.Free; end;