浏览代码

Update Enumerator version when removing key

disarray2077 4 年之前
父节点
当前提交
ce894beaa9
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      BeefLibs/corlib/src/Collections/Dictionary.bf

+ 9 - 0
BeefLibs/corlib/src/Collections/Dictionary.bf

@@ -868,6 +868,9 @@ namespace System.Collections
 			{
 				int_cosize curIdx = mIndex - 1;
 				mDictionary.Remove(mDictionary.mEntries[curIdx].mKey);
+#if VERSION_DICTIONARY
+				mVersion = mDictionary.mVersion;
+#endif
 				mIndex = curIdx;
 			}
 
@@ -1016,6 +1019,9 @@ namespace System.Collections
 			{
 				int_cosize curIdx = mIndex - 1;
 				mDictionary.Remove(mDictionary.mEntries[curIdx].mKey);
+#if VERSION_DICTIONARY
+				mVersion = mDictionary.mVersion;
+#endif
 				mIndex = curIdx;
 			}
 
@@ -1119,6 +1125,9 @@ namespace System.Collections
 			{
 				int_cosize curIdx = mIndex - 1;
 				mDictionary.Remove(mDictionary.mEntries[curIdx].mKey);
+#if VERSION_DICTIONARY
+				mVersion = mDictionary.mVersion;
+#endif
 				mIndex = curIdx;
 			}