mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-01 06:10:37 +02:00
IDE: Create a list of custom key schemes as needed before making a first write to it. Fixes memory leak when calling ./lazarus --help
.
(cherry picked from commit 44a97af383
)
This commit is contained in:
parent
1bc44cbdf7
commit
3761707e93
@ -4416,6 +4416,15 @@ begin
|
||||
LoadCustomKeySchemasInDir(p, dir);
|
||||
dir.Sort;
|
||||
|
||||
// Create CustomKeySchemas just before doing a first write to it in order
|
||||
// to avoid memory leak when calling `./lazarus --help`.
|
||||
if CustomKeySchemas = nil then
|
||||
begin
|
||||
// CustomKeySchemas should be freed in TMainIDE.Destroy destructor
|
||||
CustomKeySchemas := TStringList.Create;
|
||||
CustomKeySchemas.OwnsObjects := true;
|
||||
end;
|
||||
|
||||
CustomKeySchemas.Clear;
|
||||
CustomKeySchemas.Assign(dir);
|
||||
finally
|
||||
@ -4426,9 +4435,6 @@ end;
|
||||
initialization
|
||||
RegisterKeyCmdIdentProcs(@IdentToIDECommand,
|
||||
@IDECommandToIdent);
|
||||
// CustomKeySchemas should be freed in TMainIDE.Destroy destructor
|
||||
CustomKeySchemas := TStringList.Create;
|
||||
CustomKeySchemas.OwnsObjects := true;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -1206,7 +1206,10 @@
|
||||
<Unit>
|
||||
<Filename Value="keymapschemedlg.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="ChooseKeySchemeDlg"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="KeymapSchemeDlg"/>
|
||||
</Unit>
|
||||
<Unit>
|
||||
<Filename Value="gotofrm.pas"/>
|
||||
|
Loading…
Reference in New Issue
Block a user