Fixed memory leak in TCEFFileDialogInfo.ConvertExtensions

This commit is contained in:
Salvador Díaz Fau 2024-11-02 17:55:43 +01:00
parent f0f3e99c04
commit 3d93de5edb
2 changed files with 21 additions and 16 deletions

View File

@ -220,24 +220,29 @@ var
TempSL : TStringList;
TempExt : ustring;
begin
for i := 1 to length(aExtensions) do
if (aExtensions[i] = ';') then aExtensions[i] := #13;
try
for i := 1 to length(aExtensions) do
if (aExtensions[i] = ';') then aExtensions[i] := #13;
TempSL := TStringList.Create;
TempSL.Text := aExtensions;
Result := '';
TempSL := TStringList.Create;
TempSL.Text := aExtensions;
Result := '';
i := 0;
while (i < TempSL.Count) do
begin
TempExt := TempSL[i];
if (length(TempExt) > 1) and (TempExt[1] = '.') then
Result := Result + '*' + TempExt + ';';
inc(i);
end;
i := 0;
while (i < TempSL.Count) do
begin
TempExt := TempSL[i];
if (length(TempExt) > 1) and (TempExt[1] = '.') then
Result := Result + '*' + TempExt + ';';
inc(i);
end;
if (length(Result) > 0) and (Result[length(Result)] = ';') then
Result := copy(Result, 1, pred(length(Result)));
if (length(Result) > 0) and (Result[length(Result)] = ';') then
Result := copy(Result, 1, pred(length(Result)));
finally
if assigned(TempSL) then
FreeAndNil(TempSL);
end;
end;
function TCEFFileDialogInfo.CEFAcceptFilterToDialogFilter(const aAcceptFilter, aExtension, aDescription : ustring) : ustring;

View File

@ -2,7 +2,7 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 671,
"InternalVersion" : 672,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "130.1.10"
}