I experienced similar errors when closing forms. Following example is a simplest form.
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Memo1: TMemo;
ValueListEditor1: TValueListEditor;
procedure Button1Click(Sender: TObject);
procedure FormClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure ValueListEditor1EditingDone(Sender: TObject);
procedure ValueListEditor1Enter(Sender: TObject);
procedure ValueListEditor1Exit(Sender: TObject);
private
AStrLst: TStringList;
public
end;
implementation
procedure TForm1.FormCreate(Sender: TObject);
begin
AStrLst := TStringList.Create;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
AStrLst.Free;
end;
procedure TForm1.ValueListEditor1EditingDone(Sender: TObject);
begin
if Assigned(AStrLst) then
AStrLst.Text := ValuelistEditor1.Strings.Text; // <-- Error happens here, when closing form
end;
This is quite simple. Any change done in the ValueListEditor is saved to the AStrLst. Error occurs when I close the form, at the line I commented.
One possible cause, I guess, is related with the order of occurrence of event handlers. If the ValueListEditor1EditingDone is called after ValueListEditor1 is freed, then there should be SIGSEGV error. I'm thinking of this because I suffered problems from the order of event handlers, especially with TListView. For example, when I click TListView while the focus in TEdit, TListView's OnSelect is first called, then TListView's OnEnter is called, and then TEdit's OnExit is called.