diff options
author | Sven Gothel <[email protected]> | 2013-11-02 16:26:02 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-11-02 16:26:02 +0100 |
commit | 7433e513c1f109f75aa34c224b1f5f14b612cba8 (patch) | |
tree | 550cb4580a25698a66de55e9cafe4a28f896d5e0 /src/jogl/classes/jogamp/opengl/GLContextImpl.java | |
parent | 3ed74abaddb90cb537897b9928e923be50f7f99f (diff) |
GLContextImpl: Move sharedContextHandle check to makeCurrentWithinLock(..) and let it fail there instead of within impl. class, only pass the handle - simplifies and removes redundancy.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLContextImpl.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLContextImpl.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 3f6eb01a0..d43da2c3e 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -648,16 +648,19 @@ public abstract class GLContextImpl extends GLContext { } final GLContextImpl shareWith = (GLContextImpl) GLContextShareSet.getCreatedShare(this); + final long shareWithHandle; if (null != shareWith) { shareWith.getDrawableImpl().lockSurface(); - // FIXME: - // Contemplate whether we shall 'fail' creating this context - // if 0==shareWith.getHandle(), since at this point - // both context are locked and current values are available. + shareWithHandle = shareWith.getHandle(); + if (0 == shareWithHandle) { + throw new GLException("GLContextShareSet returned an invalid OpenGL context: "+this); + } + } else { + shareWithHandle = 0; } final boolean created; try { - created = createImpl(shareWith); // may throws exception if fails! + created = createImpl(shareWithHandle); // may throws exception if fails if( created && hasNoDefaultVAO() ) { final int[] tmp = new int[1]; final GL3ES3 gl3es3 = gl.getRootGL().getGL3ES3(); @@ -748,13 +751,13 @@ public abstract class GLContextImpl extends GLContext { * @return the valid and current context if successful, or null * @throws GLException */ - protected abstract boolean createImpl(GLContextImpl sharedWith) throws GLException ; + protected abstract boolean createImpl(long sharedWithHandle) throws GLException ; /** * Platform dependent but harmonized implementation of the <code>ARB_create_context</code> * mechanism to create a context.<br> * - * This method is called from {@link #createContextARB}, {@link #createImpl(GLContextImpl)} .. {@link #makeCurrent()} .<br> + * This method is called from {@link #createContextARB}, {@link #createImpl(long)} .. {@link #makeCurrent()} .<br> * * The implementation shall verify this context with a * <code>MakeContextCurrent</code> call.<br> |