Update of /cvsroot/instantobjects/Source/Core
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21058/Core
Modified Files:
InstantPersistence.pas
Log Message:
Changed how check of leakage with circular reference is performed, avoiding check through Release method.
Index: InstantPersistence.pas
===================================================================
RCS file: /cvsroot/instantobjects/Source/Core/InstantPersistence.pas,v
retrieving revision 1.79
retrieving revision 1.80
diff -C2 -d -r1.79 -r1.80
*** InstantPersistence.pas 24 Dec 2005 00:52:58 -0000 1.79
--- InstantPersistence.pas 31 Dec 2005 10:53:57 -0000 1.80
***************
*** 1195,1198 ****
--- 1195,1199 ----
procedure DoUnchange;
function FindDefaultContainer: TInstantContainer;
+ procedure FreeCircularReferences;
function GetClassId: string;
function GetDefaultContainer: TInstantContainer;
***************
*** 8140,8157 ****
function TInstantObject.DoRelease: Integer;
- var
- I: Integer;
begin
- // This object will be destroyed only when it is referenced
- // by other object(s) pointing each other
- if Assigned(FRefBy) and (FRefBy.Count = FRefCount-1) then
- for I := Pred(FRefBy.Count) downto 0 do
- if FRefBy[I] is TInstantComplex then
- with TInstantComplex(FRefBy[I]) do
- if (AttributeType in [atReference, atReferences]) and
- (Owner.RefCount = Owner.ReferencedBy.Count) then
- // FRefCount will be decremented whenever this object is dereferenced
- repeat until not DetachObject(Self);
-
if FRefCount > 0 then
begin
--- 8141,8145 ----
***************
*** 8296,8302 ****
end;
procedure TInstantObject.FreeInstance;
begin
! Release;
if FRefCount = 0 then
try
--- 8284,8306 ----
end;
+ procedure TInstantObject.FreeCircularReferences;
+ var
+ I: Integer;
+ begin
+ if Assigned(FRefBy) and (FRefBy.Count = FRefCount-1) then
+ for I := Pred(FRefBy.Count) downto 0 do
+ if FRefBy[I] is TInstantComplex then
+ with TInstantComplex(FRefBy[I]) do
+ if (AttributeType in [atReference, atReferences]) and
+ (Owner.RefCount = Owner.ReferencedBy.Count) then
+ // FRefCount will be decremented whenever this
+ // instance is Detached
+ repeat until not DetachObject(Self);
+ end;
+
procedure TInstantObject.FreeInstance;
begin
! FreeCircularReferences;
! DoRelease;
if FRefCount = 0 then
try
|