diff options
author | Kenneth Russel <[email protected]> | 2005-05-02 06:06:08 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2005-05-02 06:06:08 +0000 |
commit | bf3544c279ea1734dfed827c1fdbe7fa7ca9dbad (patch) | |
tree | b6e492e66da7f3ad6ffda925004f18d515a7a041 /src/net/java/games/jogl/GLCanvas.java | |
parent | 24c5dd419e8094b030a55ea86acee4dce0c61f06 (diff) |
Fixed Issue 160: Resource leaks in GLJPanel
Added addNotify and removeNotify to GLJPanel which clean up the
associated OpenGL contexts and other resources. Extended JRefract demo
to stress GLJPanel creation and destruction. New code appears to be
correct. Can see resource leaks when the bunny is loaded over and
over, but believe these are probably due to allocation of large NIO
buffers that are not getting finalized promptly. Stressing the Gears
demo with both the pbuffer and software rendering paths shows that the
OpenGL resources are being reclaimed properly.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@263 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games/jogl/GLCanvas.java')
-rw-r--r-- | src/net/java/games/jogl/GLCanvas.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/net/java/games/jogl/GLCanvas.java b/src/net/java/games/jogl/GLCanvas.java index 17aed5bea..e0065153f 100644 --- a/src/net/java/games/jogl/GLCanvas.java +++ b/src/net/java/games/jogl/GLCanvas.java @@ -59,6 +59,8 @@ import net.java.games.jogl.impl.*; public final class GLCanvas extends Canvas implements GLDrawable { + protected static final boolean DEBUG = Debug.debug("GLCanvas"); + private GLDrawableHelper drawableHelper = new GLDrawableHelper(); private GLContext context; @@ -90,6 +92,9 @@ public final class GLCanvas extends Canvas implements GLDrawable { public void addNotify() { super.addNotify(); context.setRealized(); + if (DEBUG) { + System.err.println("GLCanvas.addNotify()"); + } } /** Overridden from Canvas; used to indicate that it's no longer @@ -97,6 +102,9 @@ public final class GLCanvas extends Canvas implements GLDrawable { public void removeNotify() { context.destroy(); super.removeNotify(); + if (DEBUG) { + System.err.println("GLCanvas.removeNotify()"); + } } /** Overridden from Canvas; causes {@link GLDrawableHelper#reshape} |