Linux: Fixed crashes/lock ups when closing while debugger is opened
This commit is contained in:
parent
2a28cfc344
commit
22ed5f31d8
2 changed files with 24 additions and 6 deletions
|
@ -153,9 +153,13 @@ extern "C" {
|
|||
_console->Resume();
|
||||
}
|
||||
|
||||
DllExport void __stdcall IsPaused()
|
||||
DllExport bool __stdcall IsPaused()
|
||||
{
|
||||
_console->IsPaused();
|
||||
shared_ptr<Console> console = _console;
|
||||
if(console) {
|
||||
return console->IsPaused();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
DllExport void __stdcall Reset()
|
||||
|
|
|
@ -97,24 +97,38 @@ namespace Mesen.GUI.Forms
|
|||
this.Resize += frmMain_Resize;
|
||||
}
|
||||
|
||||
private bool _shuttingDown = false;
|
||||
protected override void OnFormClosing(FormClosingEventArgs e)
|
||||
{
|
||||
base.OnFormClosing(e);
|
||||
|
||||
DebugApi.ResumeExecution();
|
||||
DebugWindowManager.CloseAll();
|
||||
|
||||
EmuApi.Stop();
|
||||
InBackgroundHelper.StopBackgroundTimer();
|
||||
|
||||
if(_notifListener != null) {
|
||||
_notifListener.Dispose();
|
||||
_notifListener = null;
|
||||
}
|
||||
|
||||
if(!_shuttingDown && Program.IsMono) {
|
||||
//This appears to prevent Mono from locking up when closing the form
|
||||
DebugApi.ResumeExecution();
|
||||
DebugWindowManager.CloseAll();
|
||||
|
||||
Task.Run(() => {
|
||||
EmuApi.Stop();
|
||||
_shuttingDown = true;
|
||||
this.BeginInvoke((Action)(() => this.Close()));
|
||||
});
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
|
||||
ConfigManager.Config.WindowLocation = this.WindowState == FormWindowState.Normal ? this.Location : this.RestoreBounds.Location;
|
||||
ConfigManager.Config.WindowSize = this.WindowState == FormWindowState.Normal ? this.Size : this.RestoreBounds.Size;
|
||||
ConfigManager.ApplyChanges();
|
||||
ConfigManager.SaveConfig();
|
||||
|
||||
EmuApi.Stop();
|
||||
EmuApi.Release();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue