Skip to content

Commit 12878c3

Browse files
committed
Close #2130
1 parent 21fbaec commit 12878c3

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

Rubberduck.Parsing/VBA/RubberduckParserState.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,6 @@ private void ClearStateCache(string projectId, bool notifyStateChanged = false)
637637
{
638638
try
639639
{
640-
var qualifiedModuleName = new QualifiedModuleName();
641-
642640
foreach (var moduleState in _moduleStates)
643641
{
644642
if (moduleState.Key.ProjectId == projectId && moduleState.Key.Component != null)
@@ -651,15 +649,14 @@ private void ClearStateCache(string projectId, bool notifyStateChanged = false)
651649
else if (moduleState.Key.ProjectId == projectId && moduleState.Key.Component == null)
652650
{
653651
// store project module name
654-
qualifiedModuleName = moduleState.Key;
652+
var qualifiedModuleName = moduleState.Key;
653+
ModuleState state;
654+
if (_moduleStates.TryRemove(qualifiedModuleName, out state))
655+
{
656+
state.Dispose();
657+
}
655658
}
656659
}
657-
658-
ModuleState state;
659-
if (_moduleStates.TryRemove(qualifiedModuleName, out state))
660-
{
661-
state.Dispose();
662-
}
663660
}
664661
catch (COMException)
665662
{

0 commit comments

Comments
 (0)