* Fix from Luiz Americo to avoid crash when a freenotification is registered during destroy. (bug ID 23031)

git-svn-id: trunk@22589 -
This commit is contained in:
michael 2012-10-08 12:02:11 +00:00
parent d6c8ebc1b9
commit 3cafdc2a58

View File

@ -559,17 +559,12 @@ Procedure TComponent.FreeNotification(AComponent: TComponent);
begin
If (Owner<>Nil) and (AComponent=Owner) then exit;
if csDestroying in ComponentState then
AComponent.Notification(Self,opRemove)
else
If not (Assigned(FFreeNotifies)) then
FFreeNotifies:=TFpList.Create;
If FFreeNotifies.IndexOf(AComponent)=-1 then
begin
If not (Assigned(FFreeNotifies)) then
FFreeNotifies:=TFpList.Create;
If FFreeNotifies.IndexOf(AComponent)=-1 then
begin
FFreeNotifies.Add(AComponent);
AComponent.FreeNotification (self);
end;
FFreeNotifies.Add(AComponent);
AComponent.FreeNotification (self);
end;
end;