IDE: fixed memleak in the export of the todo list from Stephano (bug #11188)

git-svn-id: trunk@14952 -
This commit is contained in:
vincents 2008-04-24 19:27:46 +00:00
parent dd8ebeaf31
commit d72daa659b

View File

@ -491,23 +491,26 @@ begin
if SaveDialog1.Execute then
begin
CommaList:=TStringList.Create;
CommaList.Add('Done,Description,Priority,Module,Line,Owner,Category');
i:=0;
while i<lvTodo.Items.Count do
begin
todoItm:=TTodoItem(lvTodo.Items[i].Data);
if todoItm.Done then s:='X,' else s:=' ,';
t:=DelChars(todoItm.Text,',');{Strip any commas that can cause a faulty csv file}
s:=s+t+','+IntToStr(todoItm.Priority)+','+todoItm.Filename+
','+IntToStr(todoItm.LineNumber)+','+todoItm.Owner+','+todoItm.Category;
CommaList.Add(s);
i:=i+1;
try
CommaList.Add('Done,Description,Priority,Module,Line,Owner,Category');
i:=0;
while i<lvTodo.Items.Count do
begin
todoItm:=TTodoItem(lvTodo.Items[i].Data);
if todoItm.Done then s:='X,' else s:=' ,';
t:=DelChars(todoItm.Text,',');{Strip any commas that can cause a faulty csv file}
s:=s+t+','+IntToStr(todoItm.Priority)+','+todoItm.Filename+
','+IntToStr(todoItm.LineNumber)+','+todoItm.Owner+','+todoItm.Category;
CommaList.Add(s);
i:=i+1;
end;
CommaList.SaveToFile(SaveDialog1.FileName);
finally
CommaList.Clear;
CommaList.Free;
end;
CommaList.SaveToFile(SaveDialog1.FileName);
end
else MessageDlg('Warning','Filename is: '+SaveDialog1.FileName,mtWarning,[mbClose],0);
CommaList.Clear;
CommaList.Free;
end;
procedure TfrmTodo.acRefreshExecute(Sender: TObject);