nil FHostDockSite of child control on parent TWinControl destroying (in other case - crash if control is docked into another control)

git-svn-id: trunk@13639 -
This commit is contained in:
paul 2008-01-05 18:04:55 +00:00
parent bf7f64a57c
commit 880afb7010
2 changed files with 15 additions and 9 deletions

View File

@ -2388,14 +2388,18 @@ var
Kind: TAnchorKind;
begin
inherited Notification(AComponent, Operation);
if Operation = opRemove then begin
if AComponent = PopupMenu then PopupMenu := nil
else if AComponent = Action then Action := nil;
if Operation = opRemove then
begin
if AComponent = PopupMenu then
PopupMenu := nil
else
if AComponent = Action then
Action := nil;
//debugln('TControl.Notification A ',DbgSName(Self),' ',DbgSName(AComponent));
for Kind:=Low(TAnchorKind) to High(TAnchorKind) do begin
if (FAnchorSides[Kind]<>nil) and (FAnchorSides[Kind].Control=AComponent)
then
FAnchorSides[Kind].FControl:=nil;
for Kind := Low(TAnchorKind) to High(TAnchorKind) do
begin
if (FAnchorSides[Kind] <> nil) and (FAnchorSides[Kind].Control = AComponent) then
FAnchorSides[Kind].FControl := nil;
end;
end;
end;

View File

@ -5468,8 +5468,10 @@ begin
ListRemove(FTabList, AControl);
ListRemove(FWInControls, ACOntrol);
end else
Listremove(FControls, AControl);
AControl.FParent := Nil;
ListRemove(FControls, AControl);
AControl.FParent := nil;
if AControl.FHostDockSite = Self then
AControl.FHostDockSite := nil;
end;
end;