change how mainform disposes itself. it seems we can be disposed from deep inside winforms, likely when the window is closed. changed to not accidentally run dispose again

This commit is contained in:
zeromus 2020-08-27 15:42:32 -04:00
parent 0b73ed77ef
commit f33ac3cce6
1 changed files with 3 additions and 1 deletions

View File

@ -212,13 +212,15 @@ namespace BizHawk.Client.EmuHawk
}
else
{
using var mf = new MainForm(args);
var mf = new MainForm(args);
var title = mf.Text;
mf.Show();
mf.Text = title;
try
{
GlobalWin.ExitCode = mf.ProgramRunLoop();
if (!mf.IsDisposed)
mf.Dispose();
}
catch (Exception e) when (GlobalWin.MovieSession.Movie.IsActive() && !(Debugger.IsAttached || VersionInfo.DeveloperBuild))
{