From 7302b1014a33c373650ed20e6dd363bb6c2a984e Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 30 Sep 2012 20:29:06 +0200 Subject: NullToolkitLock.validateLocker(): Throw exception if locking is required (detecting impl. bugs) --- src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/nativewindow/classes') diff --git a/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java index 211e15955..5fc5fe376 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java +++ b/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java @@ -28,6 +28,7 @@ package jogamp.nativewindow; +import javax.media.nativewindow.NativeWindowFactory; import javax.media.nativewindow.ToolkitLock; /** @@ -35,8 +36,6 @@ import javax.media.nativewindow.ToolkitLock; * without any locking. Since there is no locking it all, it is intrinsically recursive. */ public class NullToolkitLock implements ToolkitLock { - public static final boolean INVALID_LOCKED = Debug.isPropertyDefined("nativewindow.debug.NullToolkitLock.InvalidLocked", true); - /** Singleton via {@link NativeWindowFactoryImpl#getNullToolkitLock()} */ protected NullToolkitLock() { } @@ -55,9 +54,8 @@ public class NullToolkitLock implements ToolkitLock { @Override public final void validateLocked() throws RuntimeException { - /* nop */ - if(INVALID_LOCKED) { - throw new RuntimeException("NullToolkitLock does not lock"); + if( NativeWindowFactory.requiresToolkitLock() ) { + throw new RuntimeException("NullToolkitLock does not lock, but locking is required."); } } -- cgit v1.2.3