8037477: Reproducible hang of JAWS and webstart application with JAB 2.0.4

Reviewed-by: anthony, serb
This commit is contained in:
Petr Pchelko 2014-04-21 11:00:46 +04:00
parent 81ae76b8dd
commit a2651f668e
2 changed files with 50 additions and 0 deletions

View File

@ -25,6 +25,9 @@
package javax.accessibility;
import sun.awt.AWTAccessor;
import sun.awt.AppContext;
import java.util.Locale;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
@ -79,6 +82,26 @@ import java.awt.IllegalComponentStateException;
*/
public abstract class AccessibleContext {
/**
* The AppContext that should be used to dispatch events for this
* AccessibleContext
*/
private volatile AppContext targetAppContext;
static {
AWTAccessor.setAccessibleContextAccessor(new AWTAccessor.AccessibleContextAccessor() {
@Override
public void setAppContext(AccessibleContext accessibleContext, AppContext appContext) {
accessibleContext.targetAppContext = appContext;
}
@Override
public AppContext getAppContext(AccessibleContext accessibleContext) {
return accessibleContext.targetAppContext;
}
});
}
/**
* Constant used to determine when the accessibleName property has
* changed. The old value in the PropertyChangeEvent will be the old

View File

@ -27,6 +27,7 @@ package sun.awt;
import sun.misc.Unsafe;
import javax.accessibility.AccessibleContext;
import java.awt.*;
import java.awt.KeyboardFocusManager;
import java.awt.DefaultKeyboardFocusManager;
@ -761,6 +762,14 @@ public final class AWTAccessor {
void updateSystemColors();
}
/*
* An accessor object for the AccessibleContext class
*/
public interface AccessibleContextAccessor {
void setAppContext(AccessibleContext accessibleContext, AppContext appContext);
AppContext getAppContext(AccessibleContext accessibleContext);
}
/*
* Accessor instances are initialized in the static initializers of
* corresponding AWT classes by using setters defined below.
@ -791,6 +800,7 @@ public final class AWTAccessor {
private static ToolkitAccessor toolkitAccessor;
private static InvocationEventAccessor invocationEventAccessor;
private static SystemColorAccessor systemColorAccessor;
private static AccessibleContextAccessor accessibleContextAccessor;
/*
* Set an accessor object for the java.awt.Component class.
@ -1234,4 +1244,21 @@ public final class AWTAccessor {
public static void setSystemColorAccessor(SystemColorAccessor systemColorAccessor) {
AWTAccessor.systemColorAccessor = systemColorAccessor;
}
/*
* Get the accessor object for the javax.accessibility.AccessibleContext class.
*/
public static AccessibleContextAccessor getAccessibleContextAccessor() {
if (accessibleContextAccessor == null) {
unsafe.ensureClassInitialized(AccessibleContext.class);
}
return accessibleContextAccessor;
}
/*
* Set the accessor object for the javax.accessibility.AccessibleContext class.
*/
public static void setAccessibleContextAccessor(AccessibleContextAccessor accessor) {
AWTAccessor.accessibleContextAccessor = accessor;
}
}