File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Rubberduck.Parsing/Symbols Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change 1
- using Rubberduck . Parsing . ComReflection ;
1
+ using System ;
2
+ using Rubberduck . Parsing . ComReflection ;
2
3
using Rubberduck . VBEditor ;
3
4
using System . Collections . Generic ;
4
5
using System . Linq ;
5
6
using Rubberduck . VBEditor . SafeComWrappers . Abstract ;
6
7
7
8
namespace Rubberduck . Parsing . Symbols
8
9
{
9
- public sealed class ProjectDeclaration : Declaration
10
+ public sealed class ProjectDeclaration : Declaration , IDisposable
10
11
{
11
12
private readonly List < ProjectReference > _projectReferences ;
12
13
@@ -60,7 +61,7 @@ public IReadOnlyList<ProjectReference> ProjectReferences
60
61
/// <remarks>
61
62
/// This property is intended to differenciate identically-named VBProjects.
62
63
/// </remarks>
63
- public override IVBProject Project => _project ;
64
+ public override IVBProject Project => IsDisposed ? null : _project ;
64
65
65
66
public void AddProjectReference ( string referencedProjectId , int priority )
66
67
{
@@ -89,9 +90,17 @@ public override string ProjectDisplayName
89
90
{
90
91
return _displayName ;
91
92
}
92
- _displayName = _project != null ? _project . ProjectDisplayName : string . Empty ;
93
+ _displayName = ! IsDisposed && _project != null ? _project . ProjectDisplayName : string . Empty ;
93
94
return _displayName ;
94
95
}
95
96
}
97
+
98
+
99
+ public bool IsDisposed { get ; private set ; }
100
+
101
+ public void Dispose ( )
102
+ {
103
+ IsDisposed = true ;
104
+ }
96
105
}
97
106
}
You can’t perform that action at this time.
0 commit comments