Skip to content

Commit

Permalink
Enhance Paranoia. Closes #1071. Closes #1074
Browse files Browse the repository at this point in the history
  • Loading branch information
anaisbetts committed Jul 10, 2017
1 parent 88f5ff1 commit 0df1edb
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/Update/AnimatedGifWindowWinForms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ public static void ShowWindow(TimeSpan initialDelay, CancellationToken token, Pr
}

var wnd = new AnimatedGifWindow();
wnd.Show();
if (token.IsCancellationRequested) return;

try {
wnd.Show();
} catch (Exception) {
return;
}

token.Register(() => wnd.Invoke(new Action(() => wnd.Close())));

Expand All @@ -93,7 +99,17 @@ public static void ShowWindow(TimeSpan initialDelay, CancellationToken token, Pr
wnd.Invoke(new Action(() => wnd.TopMost = false));
});

Application.Run(wnd);
if (token.IsCancellationRequested) return;

#if !DEBUG
try {
#endif
Application.Run(wnd);
#if !DEBUG
} catch (Exception) {
return;
}
#endif
});

thread.SetApartmentState(ApartmentState.STA);
Expand Down

0 comments on commit 0df1edb

Please sign in to comment.