LCL: Do not free the side components of PairSplitter. They are owned and will be freed later.

git-svn-id: trunk@64224 -
This commit is contained in:
juha 2020-12-18 10:51:36 +00:00
parent 7f0dc5b547
commit 4c9264496d

View File

@ -42,7 +42,6 @@ type
TPairSplitterSide = class(TWinControl) TPairSplitterSide = class(TWinControl)
private private
fCreatedBySplitter: boolean;
function GetSplitter: TCustomPairSplitter; function GetSplitter: TCustomPairSplitter;
protected protected
class procedure WSRegisterClass; override; class procedure WSRegisterClass; override;
@ -388,14 +387,8 @@ begin
end; end;
destructor TCustomPairSplitter.Destroy; destructor TCustomPairSplitter.Destroy;
var
i: Integer;
begin begin
// destroy the sides
fDoNotCreateSides:=true; fDoNotCreateSides:=true;
for i:=Low(FSides) to High(FSides) do
if (FSides[i]<>nil) and (FSides[i].fCreatedBySplitter) then
FSides[i].Free;
inherited Destroy; inherited Destroy;
end; end;
@ -433,8 +426,7 @@ var
ASide: TPairSplitterSide; ASide: TPairSplitterSide;
i: Integer; i: Integer;
begin begin
if fDoNotCreateSides or (csDestroying in ComponentState) if fDoNotCreateSides or (ComponentState * [csLoading,csDestroying] <> [])
or (csLoading in ComponentState)
or ((Owner<>nil) and (csLoading in Owner.ComponentState)) then exit; or ((Owner<>nil) and (csLoading in Owner.ComponentState)) then exit;
// create the missing side controls // create the missing side controls
for i := Low(FSides) to High(FSides) do for i := Low(FSides) to High(FSides) do
@ -443,7 +435,6 @@ begin
// For streaming it is important that the side controls are owned by // For streaming it is important that the side controls are owned by
// the owner of the splitter // the owner of the splitter
ASide:=TPairSplitterSide.Create(Owner); ASide:=TPairSplitterSide.Create(Owner);
ASide.fCreatedBySplitter:=true;
ASide.Parent:=Self; ASide.Parent:=Self;
end; end;
end; end;