Skip to content

Commit

Permalink
Fix possible TAStudio NRE (squashed PR #3936)
Browse files Browse the repository at this point in the history
* Skip `AskSaveChanges` in disposed `TAStudio`, fix #3499

* Revert "Skip `AskSaveChanges` in disposed `TAStudio`, fix #3499"

This reverts commit eabe939.

* Stop calling `AskSaveChanges()` on inactive tools, fix #3499
  • Loading branch information
kalimag authored Jun 5, 2024
1 parent 5da5697 commit 2c6129f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public override void Restart()

public override bool AskSaveChanges()
{
if (_unsavedZones.Count == 0 || IsDisposed)
if (_unsavedZones.Count == 0)
{
return true;
}
Expand Down
4 changes: 1 addition & 3 deletions src/BizHawk.Client.EmuHawk/tools/ToolManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -616,9 +616,7 @@ public bool AskSave()
return true;
}

return _tools
.Select(tool => tool.AskSaveChanges())
.All(result => result);
return _tools.TrueForAll(tool => !tool.IsActive || tool.AskSaveChanges());
}

/// <summary>
Expand Down

0 comments on commit 2c6129f

Please sign in to comment.