mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 01:48:03 +02:00
IDE: Prevent Access violation in Search result view when exception was raised by search. Issue #37124
git-svn-id: branches/fixes_2_0@63477 -
This commit is contained in:
parent
3f6a879586
commit
981a213c56
@ -127,7 +127,6 @@ type
|
||||
property UpdateItems: TStrings read fUpdateStrings write fUpdateStrings;
|
||||
property Updating: boolean read fUpdating;
|
||||
property Skipped: integer read FSkipped write SetSkipped;
|
||||
property Items;
|
||||
function ItemsAsStrings: TStrings;
|
||||
end;
|
||||
|
||||
@ -1122,7 +1121,7 @@ begin
|
||||
//enter a new file entry
|
||||
if not Assigned(Node) then
|
||||
begin
|
||||
Node := Items.Add(Node, MatchPos.FileName);
|
||||
Node := Items.Add(Nil, MatchPos.FileName);
|
||||
fFilenameToNode.Add(Node);
|
||||
end;
|
||||
|
||||
@ -1139,28 +1138,26 @@ begin
|
||||
inherited Create(AOwner);
|
||||
ReadOnly := True;
|
||||
fSearchObject:= TLazSearch.Create;
|
||||
fUpdateStrings:= TStringList.Create;
|
||||
fFilenameToNode:=TAvlTree.Create(@CompareTVNodeTextAsFilename);
|
||||
fUpdating:= false;
|
||||
fUpdateCount:= 0;
|
||||
fUpdateStrings:= TStringList.Create;
|
||||
FSearchInListPhrases := '';
|
||||
fFiltered := False;
|
||||
fFilenameToNode:=TAvlTree.Create(@CompareTVNodeTextAsFilename);
|
||||
end;//Create
|
||||
|
||||
Destructor TLazSearchResultTV.Destroy;
|
||||
begin
|
||||
fFilenameToNode.Free;
|
||||
if Assigned(fSearchObject) then
|
||||
FreeAndNil(fSearchObject);
|
||||
//if UpdateStrings is empty, the objects are stored in Items due to filtering
|
||||
//filtering clears UpdateStrings
|
||||
if (fUpdateStrings.Count = 0) then
|
||||
FreeObjectsTN(Items);
|
||||
if Assigned(fUpdateStrings) then
|
||||
begin
|
||||
FreeObjects(fUpdateStrings);
|
||||
FreeAndNil(fUpdateStrings);
|
||||
end;
|
||||
fFilenameToNode.Free;
|
||||
Assert(Assigned(fUpdateStrings), 'fUpdateStrings = Nil');
|
||||
FreeObjects(fUpdateStrings);
|
||||
FreeAndNil(fUpdateStrings);
|
||||
inherited Destroy;
|
||||
end;//Destroy
|
||||
|
||||
@ -1284,10 +1281,8 @@ var i: Integer;
|
||||
begin
|
||||
if (slItems.Count <= 0) then Exit;
|
||||
for i:=0 to slItems.Count-1 do
|
||||
begin
|
||||
if Assigned(slItems.Objects[i]) then
|
||||
slItems.Objects[i].Free;
|
||||
end;//End for-loop
|
||||
end;
|
||||
|
||||
function TLazSearchResultTV.BeautifyLine(const Filename: string; X, Y: integer;
|
||||
|
Loading…
Reference in New Issue
Block a user