From e392af4430af6b7b6d7f30fcca2bf00081641fe1 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 9 Nov 2011 08:19:27 +0100 Subject: Fix regression: setScreen(..) invalid ref count & flag Undo parts of commits in this regard: - 46542168d64b37f544f61802693f15b59b224e4e: move method back to ReparentAction - f51e3dad6c4bd1f6d0001cecf6a0f692400ed602: remove added ref counter / flag --- src/newt/classes/jogamp/newt/WindowImpl.java | 31 ++++++---------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 823868f2b..1ce02c8e4 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -308,30 +308,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return isNativeValid() ; } - private void recreate(boolean skipCreate) { - if(DEBUG_IMPLEMENTATION) { - System.err.println("Window.recreate() START ("+getThreadName()+", "+this+")"); - } - if(!isNativeValid()) { - throw new InternalError("XXX"); - } - ScreenImpl retainedScreen = screen; - retainedScreen.addReference(); // +1 - retain over destroy - destroy(); - setScreen(retainedScreen); - retainedScreen.removeReference(); // -1 - release - if(!skipCreate) { - setVisible(true); // native creation - } - } - - private void setScreen(ScreenImpl newScreen) { // never null ! - removeScreenReference(); - screen = newScreen; - screen.addReference(); - screenReferenceAdded = false; - } - private void removeScreenReference() { if(screenReferenceAdded) { // be nice, probably already called recursive via @@ -847,7 +823,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer public void setSize(int width, int height) { /** FIXME: freezes due to many resize events by eg AWT if( isNativeValid() && !getGraphicsConfiguration().getChosenCapabilities().isOnscreen() ) { - recreate(true); // skip create, create is done here .. + destroy(); // skip create, create is done here .. } */ runOnEDTIfAvail(true, new SetSizeActionImpl(width, height)); @@ -964,6 +940,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return reparentAction; } + private void setScreen(ScreenImpl newScreen) { // never null ! + removeScreenReference(); + screen = newScreen; + } + public final void run() { boolean animatorPaused = false; if(null!=lifecycleHook) { -- cgit v1.2.3