提交 b9a5c30d 编写于 作者: A ant

8165829: Android Studio 2.x crashes with NPE at...

8165829: Android Studio 2.x crashes with NPE at sun.lwawt.macosx.CAccessibility.getAccessibleIndexInParent
Reviewed-by: serb, ptbrunet
上级 9c2bf566
......@@ -84,6 +84,15 @@ class CAccessibility implements PropertyChangeListener {
return null;
}
static <T> T invokeAndWait(final Callable<T> callable, final Component c, final T defValue) {
T value = null;
try {
value = LWCToolkit.invokeAndWait(callable, c);
} catch (final Exception e) { e.printStackTrace(); }
return value != null ? value : defValue;
}
static void invokeLater(final Runnable runnable, final Component c) {
try {
LWCToolkit.invokeLater(runnable, c);
......@@ -179,7 +188,7 @@ class CAccessibility implements PropertyChangeListener {
return new Boolean(as.isAccessibleChildSelected(index));
}
}, c);
}, c, false);
}
public static AccessibleStateSet getAccessibleStateSet(final AccessibleContext ac, final Component c) {
......@@ -201,7 +210,7 @@ class CAccessibility implements PropertyChangeListener {
if (ass == null) return null;
return ass.contains(as);
}
}, c);
}, c, false);
}
static Field getAccessibleBundleKeyFieldWithReflection() {
......@@ -267,7 +276,7 @@ class CAccessibility implements PropertyChangeListener {
public Integer call() throws Exception {
return at.getCharCount();
}
}, c);
}, c, 0);
}
// Accessibility Threadsafety for JavaComponentAccessibility.m
......@@ -292,7 +301,7 @@ class CAccessibility implements PropertyChangeListener {
if (ac == null) return null;
return ac.getAccessibleIndexInParent();
}
}, c);
}, c, -1);
}
public static AccessibleComponent getAccessibleComponent(final Accessible a, final Component c) {
......@@ -388,7 +397,7 @@ class CAccessibility implements PropertyChangeListener {
return aComp.isFocusTraversable();
}
}, c);
}, c, false);
}
public static Accessible accessibilityHitTest(final Container parent, final float hitPointX, final float hitPointY) {
......@@ -447,7 +456,7 @@ class CAccessibility implements PropertyChangeListener {
return aComp.isEnabled();
}
}, c);
}, c, false);
}
// KCH - can we make this a postEvent instead?
......
......@@ -330,11 +330,15 @@ static NSObject *sAttributeNamesLOCK = nil;
+ (JavaComponentAccessibility *)createWithAccessible:(jobject)jaccessible withEnv:(JNIEnv *)env withView:(NSView *)view
{
JavaComponentAccessibility *ret = nil;
jobject jcomponent = [(AWTView *)view awtComponent:env];
jint index = JNFCallStaticIntMethod(env, sjm_getAccessibleIndexInParent, jaccessible, jcomponent);
NSString *javaRole = getJavaRole(env, jaccessible, jcomponent);
if (index >= 0) {
NSString *javaRole = getJavaRole(env, jaccessible, jcomponent);
ret = [self createWithAccessible:jaccessible role:javaRole index:index withEnv:env withView:view];
}
(*env)->DeleteLocalRef(env, jcomponent);
return [self createWithAccessible:jaccessible role:javaRole index:index withEnv:env withView:view];
return ret;
}
+ (JavaComponentAccessibility *) createWithAccessible:(jobject)jaccessible role:(NSString *)javaRole index:(jint)index withEnv:(JNIEnv *)env withView:(NSView *)view
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册