diff --git a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs index 08d908c3..91d4e4e1 100644 --- a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs +++ b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs @@ -192,17 +192,23 @@ namespace Vocaluxe.Lib.Video.Acinerella #endif private static readonly Object _Lock = new Object(); + private static readonly Object _DictionaryLock = new Object(); private static readonly Dictionary _AcInstanceLocks = new Dictionary(20); private static object _GetLockToken(IntPtr pAcDecoder) { - object l = null; - _AcInstanceLocks.TryGetValue(pAcDecoder.ToInt64(), out l); - if (l == null) + object l; + + lock (_DictionaryLock) { - l = new object(); - _AcInstanceLocks.Add(pAcDecoder.ToInt64(), l); + _AcInstanceLocks.TryGetValue(pAcDecoder.ToInt64(), out l); + if (l == null) + { + l = new object(); + _AcInstanceLocks.Add(pAcDecoder.ToInt64(), l); + } } + return l; }