FIX: Set variable pointing to parent before assigning parent as this might create the handle and use the variable.

This commit is contained in:
cobines 2012-05-02 09:59:31 +00:00
commit ac96be5489
2 changed files with 5 additions and 4 deletions

View file

@ -1214,6 +1214,8 @@ constructor TDrawGridEx.Create(AOwner: TComponent; AParent: TWinControl);
begin
inherited Create(AOwner);
ColumnsView := AParent as TColumnsFileView;
// Workaround for Lazarus issue 18832.
// Set Fixed... before setting ...Count.
FixedRows := 0;
@ -1223,9 +1225,6 @@ begin
RowCount := 0;
ColCount := 0;
Self.Parent := AParent;
ColumnsView := AParent as TColumnsFileView;
DoubleBuffered := True;
Align := alClient;
Options := [goFixedVertLine, goFixedHorzLine, goTabs, goRowSelect,
@ -1234,6 +1233,7 @@ begin
TitleStyle := tsStandard;
TabStop := False;
Self.Parent := AParent;
UpdateView;
end;

View file

@ -1426,11 +1426,12 @@ constructor TColumnsDrawTree.Create(AOwner: TComponent; AParent: TWinControl);
begin
inherited Create(AOwner);
Self.Parent := AParent;
ColumnsView := AParent as TColumnsFileViewVTV;
DragType := dtVCL;
HintMode := hmHint;
Self.Parent := AParent;
end;
procedure TColumnsDrawTree.AfterConstruction;