Skip to content

Commit 0a5e7a9

Browse files
committed
fixed compile error
1 parent c3aa68b commit 0a5e7a9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Source/Base/Spring.Events.pas

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -613,22 +613,24 @@ procedure TEvent.InternalInvokeMethod(UserData: Pointer;
613613
const Args: TArray<TValue>; out Result: TValue);
614614
var
615615
argsWithoutSelf: TArray<TValue>;
616+
guard: GuardedPointer;
616617
handlers: PMethodArray;
617618
i: Integer;
618619
value: TValue;
619620
begin
620621
if CanInvoke then
621622
begin
622623
argsWithoutSelf := Copy(Args, 1);
623-
handlers := AcquireGuard(fHandlers);
624+
guard := AcquireGuard(fHandlers);
625+
handlers := guard;
624626
try
625627
for i := 0 to DynArrayHigh(handlers) do
626628
begin
627629
TValue.Make(@TMethod(handlers[i]), TRttiInvokableType(UserData).Handle, value);
628630
TRttiInvokableType(UserData).Invoke(value, argsWithoutSelf);
629631
end;
630632
finally
631-
ReleaseGuard;
633+
guard.Release;
632634
end;
633635
end;
634636
end;
@@ -637,6 +639,7 @@ procedure TEvent.InternalInvokeDelegate(Method: TRttiMethod;
637639
const Args: TArray<TValue>; out Result: TValue);
638640
var
639641
argsWithoutSelf: TArray<TValue>;
642+
guard: GuardedPointer;
640643
handlers: PMethodArray;
641644
i: Integer;
642645
reference: IInterface;
@@ -645,7 +648,8 @@ procedure TEvent.InternalInvokeDelegate(Method: TRttiMethod;
645648
if CanInvoke then
646649
begin
647650
argsWithoutSelf := Copy(Args, 1);
648-
handlers := AcquireGuard(fHandlers);
651+
guard := AcquireGuard(fHandlers);
652+
handlers := guard;
649653
try
650654
for i := 0 to DynArrayHigh(handlers) do
651655
begin
@@ -654,7 +658,7 @@ procedure TEvent.InternalInvokeDelegate(Method: TRttiMethod;
654658
method.Invoke(value, argsWithoutSelf);
655659
end;
656660
finally
657-
ReleaseGuard;
661+
guard.Release;
658662
end;
659663
end;
660664
end;

0 commit comments

Comments
 (0)