Skip to content

Commit 92534c9

Browse files
committed
Fix ordering of sync to avoid name collisions on default project names.
1 parent 58a1d5b commit 92534c9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Rubberduck.Core/Navigation/CodeExplorer/CodeExplorerProjectViewModel.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,15 @@ public override void Synchronize(List<Declaration> updated)
7575

7676
Declaration = match;
7777
updated.Remove(Declaration);
78+
var children = updated.Where(declaration => declaration.ProjectId.Equals(Declaration.ProjectId)).ToList();
79+
updated.RemoveAll(declaration => declaration.ProjectId.Equals(Declaration.ProjectId));
7880

7981
// Reference synchronization is deferred to AddNewChildren for 2 reasons. First, it doesn't make sense to sling around a List of
8082
// declaration for something that doesn't need it. Second (and more importantly), the priority can't be set without calling
8183
// GetProjectReferenceModels, which hits the VBE COM interfaces. So, we only want to do that once. The bonus 3rd reason is that it
8284
// can be called from the ctor this way.
8385

84-
SynchronizeChildren(updated.Where(declaration => declaration.ProjectId.Equals(Declaration.ProjectId)).ToList());
85-
updated.RemoveAll(declaration => declaration.ProjectId.Equals(Declaration.ProjectId));
86+
SynchronizeChildren(children);
8687

8788
// Have to do this again - the project might have been saved or otherwise had the ProjectDisplayName changed.
8889
SetName();

0 commit comments

Comments
 (0)