- changed status to wontfix
DSharp.Core.Events.Pas AV
Issue #38
wontfix
A bug in DSharp.Core.Events.Pas causes AV when a Method remove Self in TEvent, here is the new code:
procedure TEvent.InternalInvoke(Params: PParameters; StackSize: Integer);
var
i: Integer;
begin
if FEnabled then
begin
i:=0;
while i<FMethods.Count do
begin
InvokeMethod(FMethods[i], Params, StackSize);
Inc(i);
end;
end;
end;
Comments (2)
-
repo owner -
Account Deleted procedure TEvent.InternalInvoke(Params: PParameters; StackSize: Integer); var i: Integer; M:TMethod; begin if FEnabled then begin i:=0; while i<FMethods.Count do begin M:=FMethods[i]; InvokeMethod(FMethods[i], Params, StackSize); if (i<FMethods.Count) and (M=FMethods[i]) then Inc(i); end; end; end;
- Log in to comment
DSharp.Core.Events is deprecated quite some time now since DSharp is basing on Spring4D (see develop branch).
The events there don't have this problem since they cache the event handlers before running them.