mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-04 20:38:16 +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;
|
||||
FMaskCaseSensitivity: TMaskCaseSensitivity;
|
||||
FObjectTypes: TObjectTypes;
|
||||
FPopulateDelayed: Boolean;
|
||||
FRoot: string;
|
||||
FShellTreeView: TCustomShellTreeView;
|
||||
FUseBuiltInIcons: Boolean;
|
||||
@ -228,6 +229,7 @@ type
|
||||
{ Methods specific to Lazarus }
|
||||
class procedure WSRegisterClass; override;
|
||||
procedure AdjustColWidths;
|
||||
procedure CreateHandle; override;
|
||||
procedure PopulateWithRoot();
|
||||
procedure DoOnResize; override;
|
||||
procedure SetAutoSizeColumns(const Value: Boolean); virtual;
|
||||
@ -1529,6 +1531,13 @@ begin
|
||||
// Check inputs
|
||||
if Trim(FRoot) = '' then Exit;
|
||||
|
||||
// Check handle
|
||||
if not HandleAllocated then
|
||||
begin
|
||||
FPopulateDelayed := true;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
Items.BeginUpdate;
|
||||
Files := TStringList.Create;
|
||||
try
|
||||
@ -1607,6 +1616,16 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomShellListView.CreateHandle;
|
||||
begin
|
||||
inherited;
|
||||
if FPopulateDelayed then
|
||||
begin
|
||||
PopulateWithRoot;
|
||||
FPopulateDelayed := false;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomShellListView.DoOnResize;
|
||||
begin
|
||||
inherited;
|
||||
|
Loading…
Reference in New Issue
Block a user