From 851bfd3a7d4edaa63186f355ec36960f343ddf81 Mon Sep 17 00:00:00 2001 From: mattias Date: Thu, 8 Oct 2015 13:38:33 +0000 Subject: [PATCH] codetools: replace helper: keep AVLNode, it may be in use by the iterator git-svn-id: trunk@49993 - --- components/codetools/finddeclarationtool.pas | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/components/codetools/finddeclarationtool.pas b/components/codetools/finddeclarationtool.pas index 1702087549..fa0ddf68cc 100644 --- a/components/codetools/finddeclarationtool.pas +++ b/components/codetools/finddeclarationtool.pas @@ -1430,14 +1430,17 @@ begin if ExprType.Desc in xtAllIdentTypes then begin if Kind=fdhlkDelphiHelper then begin - // class/type/record helpers only allow one helepr per class + // class/type/record helpers only allow one helper per class OldKey := FTree.FindKey(@ExprType, @CompareHelpersListExprType); if OldKey <> nil then begin - if Replace then - FTree.FreeAndDelete(OldKey) - else - Exit(TFDHelpersListItem(OldKey.Data)); + Result:=TFDHelpersListItem(OldKey.Data); + if Replace then begin + // keep AVLNode, it may be in use by the iterator of SearchInHelpers + Result.HelperContext.Node := HelperNode; + Result.HelperContext.Tool := Tool; + end; + exit; end; end; @@ -12210,6 +12213,8 @@ begin Result:=TFDHelpersList.Create(HelperKind); FHelpers[HelperKind]:=Result; FFreeHelpers[HelperKind]:=true; + //if HelperKind=fdhlkDelphiHelper then + // debugln(['TFindDeclarationParams.GetHelpers Self=',dbgs(Pointer(Self)),' Helper=',dbgs(Pointer(FHelpers[HelperKind]))]); end; end;