summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/classes/share/javax/media/j3d/Canvas3D.java16
-rw-r--r--src/classes/share/javax/media/j3d/Renderer.java5
-rw-r--r--src/native/d3d/Canvas3D.cpp16
3 files changed, 17 insertions, 20 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,
diff --git a/src/native/d3d/Canvas3D.cpp b/src/native/d3d/Canvas3D.cpp
index 010da46..0bc73cb 100644
--- a/src/native/d3d/Canvas3D.cpp
+++ b/src/native/d3d/Canvas3D.cpp
@@ -1112,18 +1112,10 @@ jlong JNICALL Java_javax_media_j3d_NativePipeline_createOffScreenBuffer(
jlong fbConfigListPtr,
jint width,
jint height)
-{
-
-
- if (ctx == 0) {
- // createContext() will be invoked later in Renderer
- return 1;
- } else {
- GetCtx2();
- d3dCtx->d3dPresent.BackBufferWidth = width;
- d3dCtx->d3dPresent.BackBufferHeight = height;
- return SUCCEEDED(d3dCtx->resetSurface(env, cv));
- }
+ {
+ // Issue 396.
+ // createContext() will be invoked later in Renderer
+ return 1;
}