Skip to content

Commit 135ec99

Browse files
committed
replaced __MarkDestroying method
1 parent 80b5307 commit 135ec99

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

Source/Base/Spring.Events.Base.pas

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ TEventBase = class(TRefCountedObject)
4949
fNotificationHandler: TNotificationHandler;
5050
fOnChanged: TNotifyEvent;
5151
const
52+
objDestroyingFlag = Integer($80000000);
5253
DisabledFlag = Integer($40000000);
5354
RefCountMask = Integer($3FFFFFFF);
5455
{$REGION 'Property Accessors'}
@@ -432,7 +433,7 @@ function TEventBase._Release: Integer;
432433
Result := AtomicDecrement(fRefCount) and not DisabledFlag;
433434
if Result = 0 then
434435
begin
435-
__MarkDestroying(Self);
436+
fRefCount := objDestroyingFlag;
436437
Destroy;
437438
end;
438439
end;

Source/Base/Spring.pas

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,6 @@ TRefCountedObject = class abstract
13201320
[Volatile]
13211321
{$IFEND}
13221322
fRefCount: Integer;
1323-
class procedure __MarkDestroying(const obj); static; inline;
13241323
function AsObject: TObject;
13251324
public
13261325
function QueryInterface(const IID: TGUID; out obj): HResult; stdcall;
@@ -7718,15 +7717,6 @@ function TRefCountedObject.GetRefCount: Integer;
77187717
Result := fRefCount and not objDestroyingFlag;
77197718
end;
77207719

7721-
class procedure TRefCountedObject.__MarkDestroying(const obj);
7722-
var
7723-
refCount: Integer; //FI:W517
7724-
begin
7725-
repeat
7726-
refCount := TRefCountedObject(obj).fRefCount;
7727-
until AtomicCmpExchange(TRefCountedObject(obj).fRefCount, refCount or objDestroyingFlag, refCount) = refCount;
7728-
end;
7729-
77307720
procedure TRefCountedObject.AfterConstruction;
77317721
begin
77327722
AtomicDecrement(fRefCount);
@@ -7762,7 +7752,7 @@ function TRefCountedObject._Release: Integer;
77627752
Result := AtomicDecrement(fRefCount);
77637753
if Result = 0 then
77647754
begin
7765-
__MarkDestroying(Self);
7755+
fRefCount := objDestroyingFlag;
77667756
Destroy;
77677757
end;
77687758
end;

0 commit comments

Comments
 (0)