diff --git a/app/src/processing/app/Recent.java b/app/src/processing/app/Recent.java index fc97183a9..7d2ed64c3 100644 --- a/app/src/processing/app/Recent.java +++ b/app/src/processing/app/Recent.java @@ -84,6 +84,7 @@ public class Recent { } } } + reader.close(); } updateMenu(mainMenu); updateMenu(toolbarMenu); diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index cef795f0d..919a77086 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -4910,6 +4910,7 @@ public class PApplet implements PConstants { // with the old method. outgoing.checkAlpha(); + stream.close(); // return the image return outgoing; @@ -5120,7 +5121,7 @@ public class PApplet implements PConstants { } } } - + is.close(); return outgoing; } @@ -6300,7 +6301,13 @@ public class PApplet implements PConstants { */ static public byte[] loadBytes(File file) { InputStream is = createInput(file); - return loadBytes(is); + byte[] byteArr = loadBytes(is); + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return byteArr; } /** @@ -6366,7 +6373,15 @@ public class PApplet implements PConstants { */ public String[] loadStrings(String filename) { InputStream is = createInput(filename); - if (is != null) return loadStrings(is); + if (is != null) { + String[] strArr = loadStrings(is); + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return strArr; + } System.err.println("The file \"" + filename + "\" " + "is missing or inaccessible, make sure " + diff --git a/core/src/processing/core/PShapeOBJ.java b/core/src/processing/core/PShapeOBJ.java index b135f6b86..b0f16dd34 100644 --- a/core/src/processing/core/PShapeOBJ.java +++ b/core/src/processing/core/PShapeOBJ.java @@ -232,6 +232,7 @@ public class PShapeOBJ extends PShape { BufferedReader mreader = parent.createReader(fn); if (mreader != null) { parseMTL(parent, path, mreader, materials, mtlTable); + mreader.close(); } } } else if (parts[0].equals("g")) {