TAChart: Fix silent exception EAbort in TBroadcaster. Issue #35210, patch by Marcin Wiazowski.

git-svn-id: trunk@60801 -
This commit is contained in:
wp 2019-03-31 10:44:36 +00:00
parent c53612413e
commit 23473d15d0

View File

@ -847,6 +847,7 @@ procedure TBroadcaster.Broadcast(ASender: TObject);
var var
ListCopy: array of Pointer; ListCopy: array of Pointer;
Exceptions: TStringList; Exceptions: TStringList;
Aborted: Boolean;
i: Integer; i: Integer;
begin begin
if Locked then exit; if Locked then exit;
@ -860,12 +861,16 @@ begin
ListCopy[i] := List^[i]; ListCopy[i] := List^[i];
Exceptions := nil; Exceptions := nil;
Aborted := False;
try try
for i := 0 to High(ListCopy) do for i := 0 to High(ListCopy) do
try try
TListener(ListCopy[i]).Notify(ASender); TListener(ListCopy[i]).Notify(ASender);
except except
on E: Exception do begin on E: Exception do
if E is EAbort then
Aborted := true
else begin
if not Assigned(Exceptions) then begin if not Assigned(Exceptions) then begin
Exceptions := TStringList.Create; Exceptions := TStringList.Create;
Exceptions.Duplicates := dupIgnore; Exceptions.Duplicates := dupIgnore;
@ -876,6 +881,8 @@ begin
end; end;
if Assigned(Exceptions) then if Assigned(Exceptions) then
raise EBroadcasterError.Create(Trim(Exceptions.Text)); raise EBroadcasterError.Create(Trim(Exceptions.Text));
if Aborted then
Abort;
finally finally
Exceptions.Free; Exceptions.Free;
end; end;