tastudio: keep the same identifier for updated branch.

ban context menu when there's no selection.
attempts to fix mysterious crashes in TasStateManager.
This commit is contained in:
feos 2015-10-04 18:00:04 +03:00
parent 9f67d8e59b
commit 2a8578c74f
3 changed files with 4 additions and 3 deletions

View File

@ -539,6 +539,7 @@ namespace BizHawk.Client.Common
public void UpdateBranch(TasBranch old, TasBranch newBranch)
{
int index = Branches.IndexOf(old);
newBranch.UniqueIdentifier = old.UniqueIdentifier;
Branches[index] = newBranch;
TasStateManager.UpdateBranch(index);
Changes = true;

View File

@ -265,7 +265,7 @@ namespace BizHawk.Client.Common
{
if (BranchStates.Any())
{
var kvp = BranchStates.ElementAt(1);
var kvp = BranchStates.Count() > 1 ? BranchStates.ElementAt(1) : BranchStates.ElementAt(0);
shouldRemove.X = kvp.Key;
shouldRemove.Y = kvp.Value.Keys[0];
}
@ -356,7 +356,7 @@ namespace BizHawk.Client.Common
{
if (branch == -1)
accessed.Remove(States[frame]);
else
else if (accessed.Contains(BranchStates[frame][branch]))
accessed.Remove(BranchStates[frame][branch]);
StateManagerState state;

View File

@ -538,7 +538,7 @@ namespace BizHawk.Client.EmuHawk
private void TasView_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right && !TasView.IsPointingAtColumnHeader && !_supressContextMenu)
if (e.Button == MouseButtons.Right && !TasView.IsPointingAtColumnHeader && !_supressContextMenu && TasView.SelectedRows.Any())
{
if (Global.MovieSession.Movie.FrameCount < TasView.SelectedRows.Max())
{