Skip to content

Commit 2d0dfc2

Browse files
committed
Fix another premature disposal
1 parent 74ae2dd commit 2d0dfc2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Rubberduck.Core/UI/UnitTesting/Commands/AddTestModuleCommand.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ private string DeclarationFormatFor(string declarationFormat, string type, IUnit
125125

126126
private IVBProject GetProject()
127127
{
128-
using (var activeProject = _vbe.ActiveVBProject)
128+
//No using because the wrapper gets returned potentially.
129+
var activeProject = _vbe.ActiveVBProject;
130+
if (!activeProject.IsWrappingNullReference)
129131
{
130-
if (!activeProject.IsWrappingNullReference)
131-
{
132-
return activeProject;
133-
}
132+
return activeProject;
134133
}
134+
activeProject.Dispose();
135135

136136
using (var projects = _vbe.VBProjects)
137137
{

0 commit comments

Comments
 (0)