UI: Fixed some rare crashes when shutting down
This commit is contained in:
parent
683ed7e42b
commit
c22c5b2134
2 changed files with 22 additions and 0 deletions
|
@ -24,6 +24,7 @@ namespace Mesen.GUI.Debugger
|
|||
private bool _updating = false;
|
||||
private DateTime _lastUpdate = DateTime.MinValue;
|
||||
private TabPage _selectedTab;
|
||||
private bool _formClosed;
|
||||
|
||||
public frmMemoryViewer()
|
||||
{
|
||||
|
@ -106,6 +107,13 @@ namespace Mesen.GUI.Debugger
|
|||
ConfigManager.Config.DebugInfo.RamMemoryType = cboMemoryType.GetEnumValue<DebugMemoryType>();
|
||||
ConfigManager.ApplyChanges();
|
||||
DebugWorkspaceManager.SaveWorkspace();
|
||||
|
||||
if(this._notifListener != null) {
|
||||
this._notifListener.Dispose();
|
||||
this._notifListener = null;
|
||||
}
|
||||
|
||||
_formClosed = true;
|
||||
}
|
||||
|
||||
private void InitShortcuts()
|
||||
|
@ -216,6 +224,9 @@ namespace Mesen.GUI.Debugger
|
|||
case InteropEmu.ConsoleNotificationType.GameReset:
|
||||
case InteropEmu.ConsoleNotificationType.GameLoaded:
|
||||
this.BeginInvoke((Action)(() => {
|
||||
if(_formClosed) {
|
||||
return;
|
||||
}
|
||||
this.InitMemoryTypeDropdown(false);
|
||||
ctrlMemoryAccessCounters.InitMemoryTypeDropdown();
|
||||
}));
|
||||
|
@ -306,6 +317,10 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
private void RefreshData()
|
||||
{
|
||||
if(_formClosed) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(DebugWorkspaceManager.GetWorkspace() != this._previousWorkspace) {
|
||||
this.InitTblMappings();
|
||||
_previousWorkspace = DebugWorkspaceManager.GetWorkspace();
|
||||
|
|
|
@ -52,6 +52,7 @@ namespace Mesen.GUI.Forms
|
|||
private float _yFactor = 1;
|
||||
private bool _enableResize = false;
|
||||
private bool _overrideWindowSize = false;
|
||||
private bool _shuttingDown = false;
|
||||
|
||||
private frmFullscreenRenderer _frmFullscreenRenderer = null;
|
||||
|
||||
|
@ -241,6 +242,8 @@ namespace Mesen.GUI.Forms
|
|||
return;
|
||||
}
|
||||
|
||||
_shuttingDown = true;
|
||||
|
||||
//Stop menu update timer, and process all pending events before stopping the core
|
||||
//This prevents some rare crashes on shutdown
|
||||
menuTimer.Stop();
|
||||
|
@ -913,6 +916,10 @@ namespace Mesen.GUI.Forms
|
|||
|
||||
private void UpdateMenus()
|
||||
{
|
||||
if(_shuttingDown) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if(this.InvokeRequired) {
|
||||
this.BeginInvoke((MethodInvoker)(() => this.UpdateMenus()));
|
||||
|
|
Loading…
Add table
Reference in a new issue