AV n lr_previewtoolsabstract.pas on application exit in debug mode wit LazReport and lrEmailExportfiler
Original Reporter info from Mantis: zgabrovski
-
Reporter name: Zdravko Gabrovski
Original Reporter info from Mantis: zgabrovski
- Reporter name: Zdravko Gabrovski
Description:
In my project, I am using Lazreport and lrEmailExportfiler - TlrPreviewToolsAbstract ancestor in Auto-created Datamodule.
When I close the applicarion in debug mode, it raise a AV exception (SigKill) in procedure UnRegisterLRExportFilter(AFilter: TlrPreviewToolsAbstract); in lr_previewtoolsabstract.pas.
The reason is that it executes DoFreeExportFilters; in finalization section in the same lr_previewtoolsabstract.pas unit, which does FreeAndNil(lrExportFilters); before destroying the filter class, descendant of TlrPreviewToolsAbstract class. In TlrPreviewToolsAbstract.Destroy method it call UnRegisterLRExportFilter(Self), but lrExportFilters is allready freed.
The solution is a small fix in UnRegisterLRExportFilter, which will check if lrExportFilters if availabe or not:
procedure UnRegisterLRExportFilter(AFilter: TlrPreviewToolsAbstract);
var
i: Integer;
begin
if Assigned( lrExportFilters ) then begin <---- Fix
i:=lrExportFilters.IndexOf(AFilter);
if i>=0 then
lrExportFilters.Delete(i);
end;
end;
Steps to reproduce:
i can not reproduce in empty project
Mantis conversion info:
- Mantis ID: 37027
- OS: Windows
- OS Build: 7
- Build: trunk
- Platform: Win64