mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-04 02:56:27 +02:00
LCL/ShellListView: Fix accessing unallocated handle in PopulateWithRoot/GetBuiltInImageIndex, issue #39860.
This commit is contained in:
parent
2f2a344de2
commit
4fba69291d
@ -214,6 +214,7 @@ type
|
|||||||
FMask: string;
|
FMask: string;
|
||||||
FMaskCaseSensitivity: TMaskCaseSensitivity;
|
FMaskCaseSensitivity: TMaskCaseSensitivity;
|
||||||
FObjectTypes: TObjectTypes;
|
FObjectTypes: TObjectTypes;
|
||||||
|
FPopulateDelayed: Boolean;
|
||||||
FRoot: string;
|
FRoot: string;
|
||||||
FShellTreeView: TCustomShellTreeView;
|
FShellTreeView: TCustomShellTreeView;
|
||||||
FUseBuiltInIcons: Boolean;
|
FUseBuiltInIcons: Boolean;
|
||||||
@ -228,6 +229,7 @@ type
|
|||||||
{ Methods specific to Lazarus }
|
{ Methods specific to Lazarus }
|
||||||
class procedure WSRegisterClass; override;
|
class procedure WSRegisterClass; override;
|
||||||
procedure AdjustColWidths;
|
procedure AdjustColWidths;
|
||||||
|
procedure CreateHandle; override;
|
||||||
procedure PopulateWithRoot();
|
procedure PopulateWithRoot();
|
||||||
procedure DoOnResize; override;
|
procedure DoOnResize; override;
|
||||||
procedure SetAutoSizeColumns(const Value: Boolean); virtual;
|
procedure SetAutoSizeColumns(const Value: Boolean); virtual;
|
||||||
@ -1529,6 +1531,13 @@ begin
|
|||||||
// Check inputs
|
// Check inputs
|
||||||
if Trim(FRoot) = '' then Exit;
|
if Trim(FRoot) = '' then Exit;
|
||||||
|
|
||||||
|
// Check handle
|
||||||
|
if not HandleAllocated then
|
||||||
|
begin
|
||||||
|
FPopulateDelayed := true;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
Items.BeginUpdate;
|
Items.BeginUpdate;
|
||||||
Files := TStringList.Create;
|
Files := TStringList.Create;
|
||||||
try
|
try
|
||||||
@ -1607,6 +1616,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomShellListView.CreateHandle;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
if FPopulateDelayed then
|
||||||
|
begin
|
||||||
|
PopulateWithRoot;
|
||||||
|
FPopulateDelayed := false;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomShellListView.DoOnResize;
|
procedure TCustomShellListView.DoOnResize;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
Loading…
Reference in New Issue
Block a user