fix memleak in TLazSearchResultTV.BeginUpdate

reported by Martin Friebe
Fixes: http://bugs.freepascal.org/view.php?id=12592

git-svn-id: trunk@17292 -
This commit is contained in:
darius 2008-11-09 08:58:31 +00:00
parent 317311310b
commit f2ce94e3a9

View File

@ -634,7 +634,7 @@ begin
if CurrentTV.UpdateState then
result:= CurrentTV.UpdateItems
else
result:= CurrentTV.ItemsAsStrings;
Result := CurrentTV.ItemsAsStrings;
end;//if
end;//GetItems
@ -1092,12 +1092,18 @@ begin
end;//Destroy
procedure TLazSearchResultTV.BeginUpdate;
var
s: TStrings;
begin
inc(fUpdateCount);
if (fUpdateCount = 1) then
begin
if Assigned(Items) then
fUpdateStrings.Assign(ItemsAsStrings);
begin
s := ItemsAsStrings;
fUpdateStrings.Assign(s);
s.Free;
end;
fUpdating:= true;
end;//if
end;//BeginUpdate