mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-14 22:00:10 +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
.
This commit is contained in:
parent
9700c1459b
commit
44a97af383
@ -4443,6 +4443,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
|
||||
@ -4453,9 +4462,6 @@ end;
|
||||
initialization
|
||||
RegisterKeyCmdIdentProcs(@IdentToIDECommand,
|
||||
@IDECommandToIdent);
|
||||
// CustomKeySchemas should be freed in TMainIDE.Destroy destructor
|
||||
CustomKeySchemas := TStringList.Create;
|
||||
CustomKeySchemas.OwnsObjects := true;
|
||||
|
||||
emcIdeMouseCommandOffset := AllocatePluginMouseRange(emcIdeMouseCommandsCount);
|
||||
RegisterMouseCmdIdentProcs(@IdentToIDEMouseCommand,
|
||||
|
@ -1223,7 +1223,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