From 49b4c190f955f755900b95afc54070e53c426802 Mon Sep 17 00:00:00 2001 From: sk89q Date: Wed, 9 Mar 2011 23:55:44 -0800 Subject: [PATCH] Fixed McRegionReader not being closed. --- src/com/sk89q/worldedit/data/McRegionChunkStore.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/com/sk89q/worldedit/data/McRegionChunkStore.java b/src/com/sk89q/worldedit/data/McRegionChunkStore.java index 665225a5b..c98050701 100644 --- a/src/com/sk89q/worldedit/data/McRegionChunkStore.java +++ b/src/com/sk89q/worldedit/data/McRegionChunkStore.java @@ -48,8 +48,15 @@ public abstract class McRegionChunkStore extends ChunkStore { protected McRegionReader getReader(Vector2D pos) throws DataException, IOException { String filename = getFilename(pos); - if (curFilename != null && curFilename.equals(filename)) { - return cachedReader; + if (curFilename != null) { + if (curFilename.equals(filename)) { + return cachedReader; + } else { + try { + cachedReader.close(); + } catch (IOException e) { + } + } } InputStream stream = getInputStream(filename); cachedReader = new McRegionReader(stream);