From 8de31e2b5ddade6ffaec47964b26b4a73dd0d82d Mon Sep 17 00:00:00 2001 From: Jonathan Feinberg Date: Wed, 25 Dec 2013 22:53:05 -0500 Subject: [PATCH] Clear the global PGL on dispose(). --- core/src/processing/opengl/PGraphicsOpenGL.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index 0cb501020..55edd5aa3 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -651,9 +651,13 @@ public class PGraphicsOpenGL extends PGraphics { deleteFinalizedGLResources(); if (primarySurface) pgl.deleteSurface(); + // This next line is critical to release many static allocations. + // This is important in the context of, say, a unit test suite, which + // runs more than one OpenGL sketch within the same classloader + // (as in the case of processing.py). Please don't remove it! + pgl = null; } -// @Override @Override protected void finalize() throws Throwable { try {