LCL: TWinControl.Destroy: undock all DockCLients

git-svn-id: trunk@23036 -
This commit is contained in:
mattias 2009-12-08 16:33:06 +00:00
parent a0992b75f0
commit 957ae67d77
2 changed files with 10 additions and 3 deletions

View File

@ -3919,8 +3919,7 @@ begin
// undock from old HostSite
// - this only undocks from the DockManager
// - this control still uses the DockSite as parent control
{ TODO -cdocking : Combine with ManualFloat, for consistent handling
}
{ TODO -cdocking : Combine with ManualFloat, for consistent handling }
DebugLn('TControl.ManualDock UNDOCKING ',Name);
Result:=HostDockSite.DoUndock(NewDockSite,Self);
end;

View File

@ -4989,7 +4989,7 @@ var
i: integer;
AWinControl: TWinControl;
begin
///DebugLn(['TWinControl.DestroyHandle START ',DbgSName(Self)]);
//DebugLn(['TWinControl.DestroyHandle START ',DbgSName(Self)]);
if not HandleAllocated then begin
DebugLn('Warning: TWinControl.DestroyHandle ',Name,':',ClassName,' Handle not Allocated');
//RaiseGDBException('');
@ -6284,6 +6284,7 @@ begin
Control := Controls[n - 1];
//DebugLn('[TWinControl.Destroy] C ',Name,':',ClassName,' ',Control.Name,':',Control.ClassName);
Remove(Control);
//DebugLn(['TWinControl.Destroy ',DbgSName(Control.HostDockSite)]);
if Control.HostDockSite = Self then
Control.HostDockSite := nil;
// don't free the control just set parent to nil
@ -6293,6 +6294,13 @@ begin
n := ControlCount;
end;
// undock controls that use this as HostDockSite
while DockClientCount>0 do begin
Control:=DockClients[DockClientCount-1];
//DebugLn(['TWinControl.Destroy ',DbgSName(Self),' undocking ',DbgSName(Control)]);
Control.HostDockSite:=nil;
end;
FreeThenNil(FBrush);
FreeThenNil(FChildSizing);
if (FDockManager<>nil) then