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

View File

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