From af083029321b3ff57c37f9426ecf5eb526b5e7ae Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 10 Nov 2011 05:18:57 +0100 Subject: NEWT/WindowImpl: Fix minor regression offscreen recreate @ setSize() (commit 51ad6992e068f25d86d2c9e085bd7ec6f49d2432) Even though this is not a bug, but it changes the expected EDT lifecycle and hence would require to change our test cases. Only flip screen's reference count (which may lead to create/destroy of the EDT) in the recreate case, where it's needed. --- src/newt/classes/jogamp/newt/WindowImpl.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/newt/classes/jogamp') diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 2d32414fc..180cd568e 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -773,18 +773,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } final void setSizeActionImpl(int width, int height) { + boolean recreate = false; windowLock.lock(); - screen.addReference(); // recreate case try { int visibleAction = 0; // 1 invisible, 2 visible (create) if ( !fullscreen && ( width != WindowImpl.this.width || WindowImpl.this.height != height ) ) { - final boolean recreate = isNativeValid() && !getGraphicsConfiguration().getChosenCapabilities().isOnscreen(); + recreate = isNativeValid() && !getGraphicsConfiguration().getChosenCapabilities().isOnscreen(); if(DEBUG_IMPLEMENTATION) { System.err.println("Window setSize: START "+WindowImpl.this.width+"x"+WindowImpl.this.height+" -> "+width+"x"+height+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible "+visible+", recreate "+recreate); } if(recreate) { // will trigger visibleAction:=2 -> create if wasVisible final boolean wasVisible = WindowImpl.this.visible; + screen.addReference(); // retain screen destroyAction.run(); WindowImpl.this.visible = wasVisible; } @@ -812,7 +813,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } } finally { - screen.removeReference(); // recreate case + if(recreate) { + screen.removeReference(); // bring back ref-count + } windowLock.unlock(); } } -- cgit v1.2.3