From f3ad71af24ee0975112a99f3c41f4161d685693c Mon Sep 17 00:00:00 2001 From: feos Date: Tue, 29 Sep 2015 19:51:41 +0300 Subject: [PATCH] tastudio: duplicate hash check before adding. --- BizHawk.Client.Common/movie/tasproj/TasBranch.cs | 5 ----- BizHawk.Client.Common/movie/tasproj/TasMovie.cs | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/BizHawk.Client.Common/movie/tasproj/TasBranch.cs b/BizHawk.Client.Common/movie/tasproj/TasBranch.cs index c42cf15e9d..47e416a9e4 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasBranch.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasBranch.cs @@ -9,11 +9,6 @@ namespace BizHawk.Client.Common { public class TasBranch { - public TasBranch() - { - UniqueIdentifier = Guid.NewGuid(); - } - public int Frame { get; set; } public byte[] CoreData { get; set; } public List InputLog { get; set; } diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs index 6976d6c4a3..960723ccd6 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs @@ -524,6 +524,12 @@ namespace BizHawk.Client.Common public void AddBranch(TasBranch branch) { + // before adding, make sure guid hash is unique too, we can't afford branch id clashes + do + { + branch.UniqueIdentifier = Guid.NewGuid(); + } while (BranchIndexByHash(branch.UniqueIdentifier.GetHashCode()) != -1); + Branches.Add(branch); TasStateManager.AddBranch(); Changes = true;