Skip to content

Commit 3afa448

Browse files
committed
Make the MemberAttributeRecoverer disposable
It temporarily holds an event subscription. Disposing removes that subscription.
1 parent 91f8c70 commit 3afa448

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Rubberduck.Parsing/Rewriter/MemberAttributeRecoverer.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23
using System.Linq;
34
using System.Threading;
45
using System.Threading.Tasks;
@@ -10,7 +11,7 @@
1011

1112
namespace Rubberduck.Parsing.Rewriter
1213
{
13-
public class MemberAttributeRecoverer : IMemberAttributeRecovererWithSettableRewritingManager
14+
public class MemberAttributeRecoverer : IMemberAttributeRecovererWithSettableRewritingManager, IDisposable
1415
{
1516
private readonly IDeclarationFinderProvider _declarationFinderProvider;
1617
private readonly IParseManager _parseManager;
@@ -192,5 +193,10 @@ private IDictionary<QualifiedModuleName, IEnumerable<Declaration>> MemberDeclara
192193
&& decl.ParentScopeDeclaration.DeclarationType.HasFlag(DeclarationType.Module)));
193194
return declarationsByModule;
194195
}
196+
197+
public void Dispose()
198+
{
199+
StopRecoveringAttributesOnNextParse();
200+
}
195201
}
196202
}

0 commit comments

Comments
 (0)