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

Commit e4cf04c

Browse files
committed
Merge pull request #192 from github/fixes/crash-after-publish
Fix race condition causing crash in Publish form
2 parents 61c8633 + 3cebf10 commit e4cf04c

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/GitHub.App/Controllers/UIController.cs

+9-5
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,19 @@ protected virtual void Dispose(bool disposing)
293293
if (disposing)
294294
{
295295
if (disposed) return;
296+
disposed = true;
296297

297-
Debug.WriteLine("Disposing ({0})", GetHashCode());
298-
disposables.Dispose();
299-
transition?.Dispose();
300-
completion?.Dispose();
301298
if (connectionAdded != null)
302299
connectionManager.Connections.CollectionChanged -= connectionAdded;
303300
connectionAdded = null;
304-
disposed = true;
301+
302+
var tr = transition;
303+
var cmp = completion;
304+
transition = null;
305+
completion = null;
306+
disposables.Dispose();
307+
tr?.Dispose();
308+
cmp?.Dispose();
305309
}
306310
}
307311

src/GitHub.VisualStudio/TeamExplorer/Sync/GitHubPublishSection.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,13 @@ void ShowPublish()
117117
disposable = uiflow;
118118
var ui = uiflow.Value;
119119
var creation = ui.SelectFlow(UIControllerFlow.Publish);
120-
ui.ListenToCompletionState().Subscribe(done =>
120+
bool success = false;
121+
ui.ListenToCompletionState().Subscribe(s => success = s, () =>
121122
{
123+
// there's no real cancel button in the publish form, but if support a back button there, then we want to hide the form
122124
IsVisible = false;
123-
ServiceProvider.TryGetService<ITeamExplorer>()?.NavigateToPage(new Guid(TeamExplorerPageIds.Home), null);
125+
if (success)
126+
ServiceProvider.TryGetService<ITeamExplorer>()?.NavigateToPage(new Guid(TeamExplorerPageIds.Home), null);
124127
});
125128

126129
creation.Subscribe(c =>

0 commit comments

Comments
 (0)