* Fix AV in some cases. reported by Pascal Riekenberg

This commit is contained in:
Michaël Van Canneyt 2023-12-21 13:31:07 +01:00
parent f232009010
commit 5f845aa8ff

View File

@ -454,15 +454,14 @@ end;
procedure TDBTransaction.SetDatabase(Value: TDatabase);
begin
If Value<>FDatabase then
begin
CheckInactive;
If Assigned(FDatabase) then
FDatabase.UnregisterTransaction(Self);
If Value<>Nil Then
Value.RegisterTransaction(Self);
FDatabase:=Value;
end;
If Value=FDatabase then
exit;
CheckInactive;
If Assigned(FDatabase) then
FDatabase.UnregisterTransaction(Self);
If Value<>Nil Then
Value.RegisterTransaction(Self);
FDatabase:=Value;
end;
constructor TDBTransaction.Create(AOwner: TComponent);
@ -523,9 +522,9 @@ end;
destructor TDBTransaction.Destroy;
begin
Database:=Nil;
CloseDataSets;
RemoveDatasets;
Database:=Nil;
FDatasets.Free;
Inherited;
end;