Skip to content

Commit d222e9e

Browse files
committed
Seal ParserState
1 parent bddb1b0 commit d222e9e

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

RetailCoder.VBE/API/ParserState.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public interface IParserStateEvents
3838
[ComDefaultInterface(typeof(IParserState))]
3939
[ComSourceInterfaces(typeof(IParserStateEvents))]
4040
[EditorBrowsable(EditorBrowsableState.Always)]
41-
public class ParserState : IParserState, IDisposable
41+
public sealed class ParserState : IParserState, IDisposable
4242
{
4343
private const string ClassId = "28754D11-10CC-45FD-9F6A-525A65412B7A";
4444
private const string ProgId = "Rubberduck.ParserState";
@@ -133,16 +133,10 @@ public Declaration[] UserDeclarations
133133
get { return _userDeclarations; }
134134
}
135135

136-
private bool _dispose = true;
136+
private bool _disposed;
137137
public void Dispose()
138138
{
139-
Dispose(_dispose);
140-
_dispose = false;
141-
}
142-
143-
protected virtual void Dispose(bool disposing)
144-
{
145-
if (!disposing)
139+
if (_disposed)
146140
{
147141
return;
148142
}
@@ -151,6 +145,8 @@ protected virtual void Dispose(bool disposing)
151145
{
152146
_state.StateChanged -= _state_StateChanged;
153147
}
148+
149+
_disposed = true;
154150
}
155151
}
156152
}

0 commit comments

Comments
 (0)