summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-09-30 23:18:15 +0200
committerSven Gothel <[email protected]>2014-09-30 23:18:15 +0200
commit4813455dc413fb37da28ed4845fb6f22c65629f4 (patch)
treef59045a3728be411c5cc4bde488dd69001035e78 /src/jogl/classes/jogamp/opengl
parentbd24599b21f9787ac989e65b44dc1ba762162f22 (diff)
Bug 1078: Add Fallback in AWTPrintLifecycle.setupPrint(): Use Onscreen GLAD if Offscreen-GLAD Realization throws an Exception (Stability)
- GLDrawableFactoryImpl: createOffscreenDrawable(..) and createDummyAutoDrawable(..) Temporary catch exception during setRealized(true) of newly created GLDrawable, to unrealize the instance before propagating the exception. This handling removes a memory leak in case the exception of this method is handled and application continues to operate, e.g. as in AWTPrintLifecycle.setupPrint(). The underlying drawable gets unrealized, since it's setRealized(boolean) implementation toggles its realize-state before delegating the realize-operation. Hence this is functional. - AWTPrintLifecycle.setupPrint() Stability Catch exception thrown by factory.createOffscreenAutoDrawable(..)'s setRealize(true) to continue operation w/ onscreen GLAD.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
index 8d65f16d3..b51f290e9 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
@@ -275,7 +275,14 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
final GLCapabilitiesChooser chooser,
final int width, final int height) {
final GLDrawable drawable = createOffscreenDrawable( deviceReq, capsRequested, chooser, width, height );
- drawable.setRealized(true);
+ try {
+ drawable.setRealized(true);
+ } catch( final GLException gle) {
+ try {
+ drawable.setRealized(false);
+ } catch( final GLException gle2) { /* ignore */ }
+ throw gle;
+ }
if(drawable instanceof GLFBODrawableImpl) {
return new GLOffscreenAutoDrawableImpl.FBOImpl( (GLFBODrawableImpl)drawable, null, null, null );
}
@@ -285,7 +292,14 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
@Override
public final GLAutoDrawable createDummyAutoDrawable(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser) {
final GLDrawable drawable = createDummyDrawable(deviceReq, createNewDevice, capsRequested, chooser);
- drawable.setRealized(true);
+ try {
+ drawable.setRealized(true);
+ } catch( final GLException gle) {
+ try {
+ drawable.setRealized(false);
+ } catch( final GLException gle2) { /* ignore */ }
+ throw gle;
+ }
final GLAutoDrawable sharedDrawable = new GLAutoDrawableDelegate(drawable, null, null, true /*ownDevice*/, null) { };
return sharedDrawable;
}