diff options
Diffstat (limited to 'src/classes')
-rw-r--r-- | src/classes/share/javax/media/j3d/Canvas3D.java | 16 | ||||
-rw-r--r-- | src/classes/share/javax/media/j3d/Renderer.java | 5 |
2 files changed, 13 insertions, 8 deletions
diff --git a/src/classes/share/javax/media/j3d/Canvas3D.java b/src/classes/share/javax/media/j3d/Canvas3D.java index 4b10aab..e15da57 100644 --- a/src/classes/share/javax/media/j3d/Canvas3D.java +++ b/src/classes/share/javax/media/j3d/Canvas3D.java @@ -1846,7 +1846,7 @@ public class Canvas3D extends Canvas { if (buffer != null) { ImageComponent2DRetained bufferRetained = (ImageComponent2DRetained)buffer.retained; - + if (bufferRetained.byReference && !(bufferRetained.getRefImage(0) instanceof BufferedImage)) { @@ -1896,23 +1896,25 @@ public class Canvas3D extends Canvas { // Will do destroyOffScreenBuffer in the Renderer thread. sendDestroyCtxAndOffScreenBuffer(); drawable = null; - } - + } + // Issue 396. Since context is invalid here, we should set it to null. + ctx = null; + // set the canvas dimension according to the buffer dimension offScreenCanvasSize.setSize(width, height); this.setSize(offScreenCanvasSize); - if (width > 0 && height > 0) { + if (width > 0 && height > 0) { sendCreateOffScreenBuffer(); } - ctx = null; + } - else if (ctx != null) { + else if (ctx != null) { removeCtx(); } if (freeCanvasId) { - sendFreeCanvasId(); + sendFreeCanvasId(); } offScreenBuffer = buffer; diff --git a/src/classes/share/javax/media/j3d/Renderer.java b/src/classes/share/javax/media/j3d/Renderer.java index 80d12f9..21e7534 100644 --- a/src/classes/share/javax/media/j3d/Renderer.java +++ b/src/classes/share/javax/media/j3d/Renderer.java @@ -546,8 +546,11 @@ class Renderer extends J3dThread { canvas.drawable = null; try { + // Issue 396. Pass in a null ctx for 2 reasons : + // 1) We should not use ctx field directly without buffering in a msg. + // 2) canvas.ctx should be null. canvas.drawable = - canvas.createOffScreenBuffer(canvas.ctx, + canvas.createOffScreenBuffer(null, canvas.screen.display, canvas.fbConfig, canvas.offScreenCanvasSize.width, |