TStringList.SaveToFile(string) crash if called in a TForm destructor
Original Reporter info from Mantis: BBaz @basile.b
-
Reporter name:
Original Reporter info from Mantis: BBaz @basile.b
- Reporter name:
Description:
TStringList.SaveToFile(string) crashes if called in a TForm destructor.
Seems to be a problem with avaibility of TEncoding or its critical section.
Steps to reproduce:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs;
type
{ TForm1 }
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
public
destructor Destroy; override;
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
destructor TForm1.Destroy;
begin
with TStringList.Create do
try
SaveToFile('a.txt'); // CRASH
finally
free;
end;
end;
Additional information:
for my application the SaveToFile overloads that take a TEncoding works but in the test case that crashes too.
Mantis conversion info:
- Mantis ID: 37627
- OS: linux
- Platform: x86_64