diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index eeb7df7791..395d1a78a7 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; @@ -523,21 +524,7 @@ namespace BizHawk.Client.EmuHawk DragDrop += FormDragDrop; }; - Closing += (o, e) => - { - if (Tools.AskSave()) - { - // zero 03-nov-2015 - close game after other steps. tools might need to unhook themselves from a core. - MovieSession.StopMovie(); - Tools.Close(); - CloseGame(); - SaveConfig(); - } - else - { - e.Cancel = true; - } - }; + Closing += CheckMayCloseAndCleanup; ResizeBegin += (o, e) => { @@ -794,6 +781,21 @@ namespace BizHawk.Client.EmuHawk } } + private void CheckMayCloseAndCleanup(object/*?*/ closingSender, CancelEventArgs closingArgs) + { + if (!Tools.AskSave()) + { + closingArgs.Cancel = true; + return; + } + + MovieSession.StopMovie(); + Tools.Close(); + // zero 03-nov-2015 - close game after other steps. tools might need to unhook themselves from a core. + CloseGame(); + SaveConfig(); + } + private readonly bool _suppressSyncSettingsWarning; public override bool BlocksInputWhenFocused { get; } = false;