mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-30 04:51:24 +02:00
lcl: reset parent orientation if we remove control and parent stay only with 1 child (fixes crash in insertcontrol)
git-svn-id: trunk@17865 -
This commit is contained in:
parent
4620b0c84b
commit
3817032fa7
@ -1220,12 +1220,16 @@ procedure TLazDockTree.InsertControl(AControl: TControl; InsertAt: TAlign;
|
||||
end;
|
||||
|
||||
var
|
||||
DropZone, OldParentZone, NewParentZone: TDockZone;
|
||||
CtlZone, DropZone, OldParentZone, NewParentZone: TDockZone;
|
||||
NewZone: TLazDockZone;
|
||||
NewOrientation: TDockOrientation;
|
||||
NeedNewParentZone: Boolean;
|
||||
NewBounds: TRect;
|
||||
begin
|
||||
CtlZone := RootZone.FindZone(AControl);
|
||||
if CtlZone <> nil then
|
||||
RemoveControl(AControl);
|
||||
|
||||
if (DropControl = nil) or (DropControl = AControl) then
|
||||
DropControl := DockSite;
|
||||
|
||||
@ -1359,6 +1363,10 @@ begin
|
||||
RemoveZone := ParentZone;
|
||||
end;
|
||||
|
||||
// reset orientation
|
||||
if (RemoveZone.ChildCount = 1) and (RemoveZone.Orientation in [doHorizontal, doVertical]) then
|
||||
RemoveZone.Orientation := doNoOrient;
|
||||
|
||||
// Build dock layout (anchors, splitters, pages)
|
||||
if (RemoveZone.Parent <> nil) then
|
||||
BuildDockLayout(RemoveZone.Parent as TLazDockZone)
|
||||
|
Loading…
Reference in New Issue
Block a user