浏览代码

make sure to close FileInput before return

Nicolas Cannasse 5 年之前
父节点
当前提交
ae389efd03
共有 2 个文件被更改,包括 6 次插入2 次删除
  1. 3 1
      hxd/res/Gradients.hx
  2. 3 1
      hxd/res/Model.hx

+ 3 - 1
hxd/res/Gradients.hx

@@ -125,7 +125,9 @@ class Gradients extends Resource {
 
 
 	function getData() : Data {
 	function getData() : Data {
 		if (data != null) return data;
 		if (data != null) return data;
-		data = new hxd.fmt.grd.Reader(new hxd.fs.FileInput(entry)).read();
+		var fs = new hxd.fs.FileInput(entry);
+		data = new hxd.fmt.grd.Reader(fs).read();
+		fs.close();
 		return data;
 		return data;
 	}
 	}
 }
 }

+ 3 - 1
hxd/res/Model.hx

@@ -3,7 +3,9 @@ package hxd.res;
 class Model extends Resource {
 class Model extends Resource {
 
 
 	public function toHmd() : hxd.fmt.hmd.Library {
 	public function toHmd() : hxd.fmt.hmd.Library {
-		var hmd = new hxd.fmt.hmd.Reader(new hxd.fs.FileInput(entry)).readHeader();
+		var fs = new hxd.fs.FileInput(entry);
+		var hmd = new hxd.fmt.hmd.Reader(fs).readHeader();
+		fs.close();
 		return new hxd.fmt.hmd.Library(this, hmd);
 		return new hxd.fmt.hmd.Library(this, hmd);
 	}
 	}