Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 6a5e5fc

Browse files
committed
Correctly implement Dispose pattern.
1 parent 78db63d commit 6a5e5fc

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/GitHub.UI.Reactive/Controls/ViewBase.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,11 @@ public void Dispose()
213213
/// </summary>
214214
protected virtual void Dispose(bool disposing)
215215
{
216-
subscriptions?.Dispose();
217-
subscriptions = null;
216+
if (disposing)
217+
{
218+
subscriptions?.Dispose();
219+
subscriptions = null;
220+
}
218221
}
219222
}
220223
}

src/GitHub.VisualStudio/UI/Views/PullRequestListView.xaml.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,18 @@ public PullRequestListView(IGitHubServiceProvider serviceProvider)
5858
public ICommand OpenPROnGitHub { get; set; }
5959

6060
bool disposed;
61-
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1816:CallGCSuppressFinalizeCorrectly")]
6261
protected override void Dispose(bool disposing)
6362
{
6463
base.Dispose(disposing);
6564

6665
if (disposed) return;
6766

68-
open.Dispose();
69-
create.Dispose();
70-
disposed = true;
67+
if (disposing)
68+
{
69+
open.Dispose();
70+
create.Dispose();
71+
disposed = true;
72+
}
7173
}
7274
}
7375
}

0 commit comments

Comments
 (0)