/** * Default implementation to destroys the drawable and context of this GLAutoDrawable: * * <ul> * <li>issues the GLEventListener dispose call, if drawable and context are valid * <li>destroys the GLContext, if valid * <li>destroys the GLDrawable, if valid * </ul> * * <p>Method assumes the lock is being hold. * * <p>Override it to extend it to destroy your resources, i.e. the actual window. In such case * call <code>super.destroyImplInLock</code> first. */ protected void destroyImplInLock() { if (preserveGLELSAtDestroy) { preserveGLStateAtDestroy(false); preserveGLEventListenerState(); } if (null != context) { if (context.isCreated()) { // Catch dispose GLExceptions by GLEventListener, just 'print' them // so we can continue with the destruction. try { helper.disposeGL(this, context, true); } catch (GLException gle) { gle.printStackTrace(); } } context = null; } if (null != drawable) { final AbstractGraphicsDevice device = drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); drawable.setRealized(false); drawable = null; if (ownsDevice) { device.close(); } } }
private void dispose() { if (null != awtConfig) { AbstractGraphicsDevice adevice = awtConfig.getNativeGraphicsConfiguration().getScreen().getDevice(); String adeviceMsg = null; if (Window.DEBUG_IMPLEMENTATION) { adeviceMsg = adevice.toString(); } boolean closed = adevice.close(); if (Window.DEBUG_IMPLEMENTATION) { System.err.println( "AWTCanvas.dispose(): closed GraphicsDevice: " + adeviceMsg + ", result: " + closed); } } }