Make "FreeObjectProperties" a method of TBaseRemotable

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2839 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa
2013-11-19 10:52:20 +00:00
parent ac388ad3f8
commit 048ad30635

View File

@ -264,6 +264,10 @@ type
TBaseRemotable = class(TPersistent) TBaseRemotable = class(TPersistent)
Public Public
constructor Create();virtual; constructor Create();virtual;
destructor Destroy();override;
// This will free objects and arrays properties and set them to nil.
procedure FreeObjectProperties();virtual;
class procedure Save( class procedure Save(
AObject : TBaseRemotable; AObject : TBaseRemotable;
AStore : IFormatterBase; AStore : IFormatterBase;
@ -547,8 +551,6 @@ type
var AName : string; var AName : string;
const ATypeInfo : PTypeInfo const ATypeInfo : PTypeInfo
);override; );override;
// This will free objects and arrays properties and set them to nil.
procedure FreeObjectProperties();virtual;
end; end;
TRemotableRecordEncoderClass = class of TRemotableRecordEncoder; TRemotableRecordEncoderClass = class of TRemotableRecordEncoder;
@ -2038,6 +2040,17 @@ constructor TBaseRemotable.Create();
begin begin
end; end;
destructor TBaseRemotable.Destroy();
begin
FreeObjectProperties();
inherited Destroy();
end;
procedure TBaseRemotable.FreeObjectProperties();
begin
//Derived classes should override this method to free their object(s) and array(s).
end;
function TBaseRemotable.Equal(const ACompareTo : TBaseRemotable) : Boolean; function TBaseRemotable.Equal(const ACompareTo : TBaseRemotable) : Boolean;
begin begin
Result := ( Self = ACompareTo ); Result := ( Self = ACompareTo );
@ -2578,11 +2591,6 @@ begin
end; end;
{$ENDIF USE_SERIALIZE} {$ENDIF USE_SERIALIZE}
procedure TBaseComplexRemotable.FreeObjectProperties();
begin
//Derived classes should override this method to free their object(s) and array(s).
end;
{ TBaseObjectArrayRemotable } { TBaseObjectArrayRemotable }
function TBaseObjectArrayRemotable.GetItem(AIndex: Integer): TBaseRemotable; function TBaseObjectArrayRemotable.GetItem(AIndex: Integer): TBaseRemotable;