Hello,
Lazarus 1.8.4 64bit on Windows 10 pro 64bit
IBX SVN revision 238, latest. should be the same as 2.3.0 release.
I found that the application may crash when I close it if it is running lazarus ide. as a standalone EXE it is fine. I think I first saw this problem after I updated to IBX 2.3.0. I think I was using IBX 2.2.0
Is there any problem with my code? or anyone seeing this kind of problem? it feels like a race condition in transaction shut down code.
the crash happens at this line in FormClose event.
self.IBDatabase1.DefaultTransaction.Active:=false;
procedure TForm1.FormCreate(Sender: TObject);
begin
DateTimePicker1.Date:=now;
DateTimePicker1Change(self);
end;
procedure TForm1.IBDatabase1AfterConnect(Sender: TObject);
begin
IBEvents1.RegisterEvents;
end;
procedure TForm1.IBEvents1EventAlert(Sender: TObject; EventName: string;
EventCount: longint; var CancelAlerts: Boolean);
begin
DateTimePicker1Change(self);//reload data
end;
procedure TForm1.DateTimePicker1Change(Sender: TObject);
begin
//simplified, there's a date condition based on a checkbox
ibquery1.SQL.clear;
ibquery2.SQL.clear;
ibquery3.SQL.clear;
ibquery1.SQL.Add('select something');
ibquery2.SQL.Add('select something');
ibquery3.SQL.Add('select something');
ibquery1.close;
ibquery1.open;
ibquery2.close;
ibquery2.open;
ibquery3.close;
ibquery3.open;
end;
procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
ibquery1.close;
ibquery2.close;
ibquery3.close;
ibevents1.UnRegisterEvents;
self.IBDatabase1.DefaultTransaction.Active:=false;//crashing here
self.IBDatabase1.Close();
end;