diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/classes/share/javax/media/j3d/J3DGraphics2DImpl.java | 7 | ||||
-rw-r--r-- | src/classes/share/javax/media/j3d/Renderer.java | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/classes/share/javax/media/j3d/J3DGraphics2DImpl.java b/src/classes/share/javax/media/j3d/J3DGraphics2DImpl.java index 381e92f..74d7ee0 100644 --- a/src/classes/share/javax/media/j3d/J3DGraphics2DImpl.java +++ b/src/classes/share/javax/media/j3d/J3DGraphics2DImpl.java @@ -894,6 +894,11 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { // Issue 121 - release all resources, mark as disposed public void dispose() { + // Issue 583 - do nothing if graphics has already been disposed + if (hasBeenDisposed) { + return; + } + if (Thread.currentThread() == canvas3d.screen.renderer) { doDispose(); } else { @@ -927,6 +932,8 @@ final class J3DGraphics2DImpl extends J3DGraphics2D { // Mark as disposed hasBeenDisposed = true; + // Issue 583 - set graphics2D field to null so it will get recreated + canvas3d.graphics2D = null; } public void drawAndFlushImage(BufferedImage img, int x, int y, diff --git a/src/classes/share/javax/media/j3d/Renderer.java b/src/classes/share/javax/media/j3d/Renderer.java index cf1edf9..7861f7f 100644 --- a/src/classes/share/javax/media/j3d/Renderer.java +++ b/src/classes/share/javax/media/j3d/Renderer.java @@ -762,7 +762,10 @@ class Renderer extends J3dThread { (ImageObserver) ar[4]); break; case GraphicsContext3D.DISPOSE2D: - canvas.graphics2D.doDispose(); + // Issue 583 - the graphics2D field may be null here + if (canvas.graphics2D != null) { + canvas.graphics2D.doDispose(); + } break; case GraphicsContext3D.SET_MODELCLIP: canvas.graphicsContext3D.doSetModelClip( |