aboutsummaryrefslogtreecommitdiffstats
path: root/src/nativewindow
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-09-30 20:36:27 +0200
committerSven Gothel <[email protected]>2012-09-30 20:36:27 +0200
commit0790108ca9c2a6a6d494e5017589fe083c518e23 (patch)
treeab2647f75b1d43a29e5646db5991713fdc99fed8 /src/nativewindow
parentc69d62a7869ba8e42ba4f4a6d4467bc1c49080e4 (diff)
JAWTUtil ToolkitLock: Add lock counter to make lock validation recursive (Fix regression of commit 92398025abdabb2fdef0d78edd41e730991a6f94)
Diffstat (limited to 'src/nativewindow')
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
index 2dadfb16b..67c64a95c 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
@@ -81,6 +81,7 @@ public class JAWTUtil {
private static final boolean hasSunToolkitAWTLock;
private static volatile Thread exclusiveOwnerThread;
+ private static int lockCounter;
private static final ToolkitLock jawtToolkitLock;
@@ -232,6 +233,7 @@ public class JAWTUtil {
hasSunToolkitAWTLock = _hasSunToolkitAWTLock;
// hasSunToolkitAWTLock = false;
exclusiveOwnerThread = null;
+ lockCounter = 0;
jawtToolkitLock = new ToolkitLock() {
public final void lock() {
@@ -334,7 +336,10 @@ public class JAWTUtil {
} else {
jawtLockObject.Lock();
}
- exclusiveOwnerThread = Thread.currentThread();
+ if(0 == lockCounter) {
+ exclusiveOwnerThread = Thread.currentThread();
+ }
+ lockCounter++;
}
/**
@@ -345,7 +350,10 @@ public class JAWTUtil {
*/
private static final void awtUnlock() {
awtValidateLocked();
- exclusiveOwnerThread = null;
+ lockCounter--;
+ if(0 == lockCounter) {
+ exclusiveOwnerThread = null;
+ }
if(hasSunToolkitAWTLock) {
try {
sunToolkitAWTUnlockMethod.invoke(null, (Object[])null);