6796915: Deadlock in XAWT when switching virtual desktops
Reviewed-by: art, anthony
This commit is contained in:
parent
68c236347f
commit
7628a59414
@ -534,15 +534,18 @@ final class XDropTargetRegistry {
|
||||
return entry.getSite(x, y);
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: this method should be called under AWT lock.
|
||||
*/
|
||||
public void registerDropSite(long window) {
|
||||
assert XToolkit.isAWTLockHeldByCurrentThread();
|
||||
|
||||
if (window == 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
XDropTargetEventProcessor.activate();
|
||||
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
long toplevel = getToplevelWindow(window);
|
||||
|
||||
/*
|
||||
@ -570,18 +573,18 @@ final class XDropTargetRegistry {
|
||||
} else {
|
||||
registerEmbeddedDropSite(toplevel, window);
|
||||
}
|
||||
} finally {
|
||||
XToolkit.awtUnlock();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: this method should be called under AWT lock.
|
||||
*/
|
||||
public void unregisterDropSite(long window) {
|
||||
assert XToolkit.isAWTLockHeldByCurrentThread();
|
||||
|
||||
if (window == 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
long toplevel = getToplevelWindow(window);
|
||||
|
||||
if (toplevel == window) {
|
||||
@ -597,9 +600,6 @@ final class XDropTargetRegistry {
|
||||
} else {
|
||||
unregisterEmbeddedDropSite(toplevel, window);
|
||||
}
|
||||
} finally {
|
||||
XToolkit.awtUnlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void registerXEmbedClient(long canvasWindow, long clientWindow) {
|
||||
|
@ -1757,9 +1757,12 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
}
|
||||
}
|
||||
|
||||
// should be synchronized on awtLock
|
||||
private int dropTargetCount = 0;
|
||||
|
||||
public synchronized void addDropTarget() {
|
||||
public void addDropTarget() {
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
if (dropTargetCount == 0) {
|
||||
long window = getWindow();
|
||||
if (window != 0) {
|
||||
@ -1767,9 +1770,14 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
}
|
||||
}
|
||||
dropTargetCount++;
|
||||
} finally {
|
||||
XToolkit.awtUnlock();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void removeDropTarget() {
|
||||
public void removeDropTarget() {
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
dropTargetCount--;
|
||||
if (dropTargetCount == 0) {
|
||||
long window = getWindow();
|
||||
@ -1777,6 +1785,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
XDropTargetRegistry.getRegistry().unregisterDropSite(window);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
XToolkit.awtUnlock();
|
||||
}
|
||||
}
|
||||
void addRootPropertyEventDispatcher() {
|
||||
if( rootPropertyEventDispatcher == null ) {
|
||||
@ -1838,7 +1849,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
}
|
||||
}
|
||||
|
||||
protected synchronized void updateDropTarget() {
|
||||
protected void updateDropTarget() {
|
||||
XToolkit.awtLock();
|
||||
try {
|
||||
if (dropTargetCount > 0) {
|
||||
long window = getWindow();
|
||||
if (window != 0) {
|
||||
@ -1846,6 +1859,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
XDropTargetRegistry.getRegistry().registerDropSite(window);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
XToolkit.awtUnlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void setGrab(boolean grab) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user