(VFS.FullPath): dispose enumerable iterator.

This commit is contained in:
morkt 2016-10-17 16:53:55 +04:00
parent 3e8718d6c3
commit 375e162959

View File

@ -662,13 +662,15 @@ namespace GameRes
return; return;
var desired = value.ToArray(); var desired = value.ToArray();
int desired_vfs_count = desired.Length; int desired_vfs_count = desired.Length;
var arc_iterator = m_vfs.ArcStack.Reverse().GetEnumerator();
int i = 0; int i = 0;
while (i < desired_vfs_count - 1 && arc_iterator.MoveNext()) using (var arc_iterator = m_vfs.ArcStack.Reverse().GetEnumerator())
{ {
if (arc_iterator.Current != desired[i]) while (i < desired_vfs_count - 1 && arc_iterator.MoveNext())
break; {
++i; if (arc_iterator.Current != desired[i])
break;
++i;
}
} }
while (Count > i+1) while (Count > i+1)
m_vfs.Pop(); m_vfs.Pop();