Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed solution to Issue #1071 #1074

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/Update/AnimatedGifWindowWinForms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ public static void ShowWindow(TimeSpan initialDelay, CancellationToken token, Pr
return;
}

var wnd = new AnimatedGifWindow();
Form wnd = new AnimatedGifWindow();
wnd.Show();
if (!wnd.IsHandleCreated) //failsafe. in case the app launches *BEFORE it tries to create new window handle. which will cause the exit ..
{
return;
}

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

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

Application.Run(wnd);
if (wnd.IsHandleCreated) //failsafe. in case the app launches *AFTER handle has already been created.
{ //##TODO should implement a test with large and small (Kb vs Gig) nuget packages to see different timing results.
Application.Run(wnd);
}
});

thread.SetApartmentState(ApartmentState.STA);
Expand Down