IDE: reduce memleaks when loading custom keyscheme, based on part of patch by Dean Mustakinov, issue #40559

(cherry picked from commit a187c73c68)
This commit is contained in:
Maxim Ganetsky 2023-11-08 18:21:58 +03:00
parent 91c3bf3781
commit dd0b913271

View File

@ -4375,12 +4375,18 @@ begin
try
xml := TXMLConfig.Create(fn[i]);
exp := TKeyCommandRelationList.Create;
nm := xml.GetValue('Name/Value','');
if nm = '' then nm := ExtractFileName(fn[i]);
if (dst.IndexOf(nm)<0) then begin
exp.DefineCommandCategories; // default Relations
exp.LoadFromXMLConfig(xml, 'KeyMapping/', false);
dst.AddObject(nm, exp);
try
nm := xml.GetValue('Name/Value','');
if nm = '' then nm := ExtractFileName(fn[i]);
if (dst.IndexOf(nm)<0) then begin
exp.DefineCommandCategories; // default Relations
exp.LoadFromXMLConfig(xml, 'KeyMapping/', false);
dst.AddObject(nm, exp);
exp := nil;
end;
finally
xml.Free;
exp.Free;
end;
except
end;