madorin / fibplus

FibPlus Library for Delphi and C++Builder. Data access components for Firebird & Interbase.
168 stars 58 forks source link

Освобождение объектов в деструкторе #25

Closed CyberMaxRu closed 4 years ago

CyberMaxRu commented 6 years ago

В классе TFIBCustomDataSet вот такой страшный код:

destructor TFIBCustomDataSet.Destroy;
begin
  inherited Destroy;

{$IFDEF CSMonitor}
  FCSMonitorSupport.Free;
{$ENDIF}

  FSourceLink.Free;
  FBase.Free;
  ClearBlobStreamList;
  FBlobStreamList.Free;
  FOpenedBlobStreams.Free;
  FRelationTables.Free;
  vFieldDescrList.Free;
  FSQLs.Free;
  FFilterParser.Free;
  FFilterParser:=nil;
  FRecordsCache.Free;
  FRecordsCache:=nil;
  FAutoUpdateOptions.Free;
  FFNFields.Free;
  FFNFields:=nil;
  if Assigned(FKeyFieldsForBookMark) then
   FKeyFieldsForBookMark.Free;

  FreeAndNil(vTimerForDetail);
  FreeAndNil(vScrollTimer);
 FCacheModelOptions.Free;
 FreeMem(vPartition);
 FFilteredCacheInfo.NonVisibleRecords.Free;
end;

Предлагаю в деструкторах заменить все .Free и .Free/:= nil на FreeAndNil().

EndErr commented 6 years ago

+1