Explorar el Código

make sure to close FileInput before return

Nicolas Cannasse hace 5 años
padre
commit
ae389efd03
Se han modificado 2 ficheros con 6 adiciones y 2 borrados
  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 {
 		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;
 	}
 }

+ 3 - 1
hxd/res/Model.hx

@@ -3,7 +3,9 @@ package hxd.res;
 class Model extends Resource {
 
 	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);
 	}