From 375e1629596007e2113e47258ec3171064bf8b62 Mon Sep 17 00:00:00 2001 From: morkt Date: Mon, 17 Oct 2016 16:53:55 +0400 Subject: [PATCH] (VFS.FullPath): dispose enumerable iterator. --- GameRes/FileSystem.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/GameRes/FileSystem.cs b/GameRes/FileSystem.cs index 57953d8d..4427518d 100644 --- a/GameRes/FileSystem.cs +++ b/GameRes/FileSystem.cs @@ -662,13 +662,15 @@ namespace GameRes return; var desired = value.ToArray(); int desired_vfs_count = desired.Length; - var arc_iterator = m_vfs.ArcStack.Reverse().GetEnumerator(); 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]) - break; - ++i; + while (i < desired_vfs_count - 1 && arc_iterator.MoveNext()) + { + if (arc_iterator.Current != desired[i]) + break; + ++i; + } } while (Count > i+1) m_vfs.Pop();