View Issue Details

IDProjectCategoryView StatusLast Update
0038258LazarusLCLpublic2020-12-28 19:54
ReporterZdravko Gabrovski Assigned ToJesus Reyes  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformAllOSAll 
Fixed in Version2.1 (SVN) 
Summary0038258: LazReport raises AV after Export through standard save button in standard preview form
DescriptionThe problem comes from
function TfrReport.ExportTo(FilterClass: TfrExportFilterClass; aFileName: String
  ): Boolean, line 11255 - fDefExportFilterClass := FCurrentFilter.ClassName;

In that point FCurrentFilter is already freed by function call at line 11252
result := ExportTo(FilterClass, exportStream, true);

The fix attached:

Just move fDefExportFilterClass := FCurrentFilter.ClassName; in other ExportTo procedure in finally section just before FreeAndNil(FCurrentFilter).

Please, check and apply provided patch.


Steps To ReproduceAdd any LazReport and any export filter.
Execute standard "Preview" or "Preview Modal"

then, click the button with diskette icon to export the report.
Choose file name, press "Save".

You will receive "Access violation"
TagsNo tags attached.
Fixed in Revision64289
LazTarget2.2
Widgetset
Attached Files

Activities

Zdravko Gabrovski

2020-12-25 20:53

reporter  

lr_class.diff (670 bytes)   
Index: components/lazreport/source/lr_class.pas
===================================================================
--- components/lazreport/source/lr_class.pas	(revision 64121)
+++ components/lazreport/source/lr_class.pas	(working copy)
@@ -11252,7 +11252,6 @@
   result := ExportTo(FilterClass, exportStream, true);
   if result then
   begin
-    fDefExportFilterClass := FCurrentFilter.ClassName;
     fDefExportFileName := aFileName;
   end;
 
@@ -11330,6 +11329,10 @@
       FCurrentFilter.AfterExport;
 
   finally
+    if result then
+    begin
+      fDefExportFilterClass := FCurrentFilter.ClassName;
+    end;
     FreeAndNil(FCurrentFilter);
   end;
 
lr_class.diff (670 bytes)   

Zdravko Gabrovski

2020-12-25 20:54

reporter   ~0127800

Sorry forgot to mention the problem is in LR_Class.pas unit, Lazreport package.

Jesus Reyes

2020-12-28 16:46

developer   ~0127866

This was a regression
Thanks for your fix
Applied.

Zdravko Gabrovski

2020-12-28 19:54

reporter   ~0127871

Thanks!

Issue History

Date Modified Username Field Change
2020-12-25 20:53 Zdravko Gabrovski New Issue
2020-12-25 20:53 Zdravko Gabrovski File Added: lr_class.diff
2020-12-25 20:54 Zdravko Gabrovski Note Added: 0127800
2020-12-25 21:01 Jonas Maebe Project FPC => Lazarus
2020-12-26 08:03 Jesus Reyes Assigned To => Jesus Reyes
2020-12-26 08:03 Jesus Reyes Status new => assigned
2020-12-28 16:46 Jesus Reyes Status assigned => resolved
2020-12-28 16:46 Jesus Reyes Resolution open => fixed
2020-12-28 16:46 Jesus Reyes Fixed in Version => 2.1 (SVN)
2020-12-28 16:46 Jesus Reyes Fixed in Revision => 64289
2020-12-28 16:46 Jesus Reyes LazTarget => 2.2
2020-12-28 16:46 Jesus Reyes Note Added: 0127866
2020-12-28 19:54 Zdravko Gabrovski Note Added: 0127871