need help, whats wrong with my code :
for test,
i use menuitem1 to create form2 and open it as showmodal,
after close form2 using menu tutup in form2 , in form1 i click menuitem1 again to show again form2 and close form2 using menututup in form2
after click menututup i get access violation...
i dont know what caused error AV ...
i put caFree in form2close not work too,
procedure TForm2.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
CloseAction := caFree;
end;
i see lcldebug.log contain
TApplication.HandleException Access violation
Stack trace:
$0001B730
$F000FFFC
$000230D4
procedure TForm1.MenuItem1Click(Sender: TObject);
begin
//if Assigned(Form2) then
// ShowMessage('something wrong, form2 must be nil');
Form2 := TForm2.Create(Self);
try
Form2.ShowModal;
finally
Form2.Free;
//FreeAndNil(form2)
end;
end;
i test in
- Lazarus-1.1-38850-fpc-2.6.0-20120927-win32.exe + Lazarus-1.1-38850-fpc-2.6.0-20120927-cross-arm-wince-win32.exe
- Lazarus-1.1-37629-fpc-2.6.1-20120612-cross-arm-wince-win32.exe + Lazarus-1.1-37629-fpc-2.6.1-20120612-win32.exe
- fpc 2.71 codetyphon too
thanks
Irwan