Mr.Darcy
Mr.Darcy

Reputation: 21

AnyDAC - TADConnection attribute FCommands contains released objects

At the moment we are migrating the database component of our Delphi7 application from the BDE components to AnyDAC Version 8.0.5 components (in the meantime known as FireDAC).

We are using the following controls in our MDI child form:

all database controls are connected to each other

When we change two or three records, we'll receive an EAccessViolation during the disconnect of the TADCustomConnection. The EAccessViolation appears in the following method of the TCustomConnection (inside unit DB):

procedure TCustomConnection.SendConnectEvent(Connecting: Boolean);
var
  I: Integer;
  ConnectEvent: TConnectChangeEvent;
begin
  for I := 0 to FClients.Count - 1 do
  begin
    if FConnectEvents[I] <> nil then
    begin
      TMethod(ConnectEvent).Code := FConnectEvents[I];
      TMethod(ConnectEvent).Data := FClients[I];
      ConnectEvent(Self, Connecting);
    end;
    if TObject(FClients[I]) is TDataset then  // <-- raises the EAccessViolation
      TDataSet(FClients[I]).DataEvent(deConnectChange, Integer(Connecting));
  end;
end;

Reason for this EAccessViolation is the fact that the TADCustomConnection.FCommands attribute contains released TADCommands. Normally everything works like a charm, but if we exclude fiBlobs in the TADTable.FetchOption.Items or if we just execute the RefreshRecord method in the event TADTable.BeforeEdit we receive the EAccessViolation.

Any help is greatly appreciated.

Upvotes: 1

Views: 260

Answers (0)

Related Questions