Skip to content
This repository was archived by the owner on Mar 8, 2024. It is now read-only.

Commit 02f9a5f

Browse files
committedJan 21, 2016
IDEA-148854: AppCode crashes randomly every 15 mins or so
--HG-- branch : 8u40-verified-fixes
1 parent deb7383 commit 02f9a5f

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed
 

‎src/macosx/classes/sun/lwawt/macosx/CAccessibility.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ static <T> T invokeAndWait(final Callable<T> callable, final Component c) {
8282
return null;
8383
}
8484

85+
static <T> T invokeAndWait(final Callable<T> callable, final Component c, final T defValue) {
86+
T value = null;
87+
try {
88+
value = LWCToolkit.invokeAndWait(callable, c);
89+
} catch (final Exception e) { e.printStackTrace(); }
90+
91+
return value != null ? value : defValue;
92+
}
93+
8594
static void invokeLater(final Runnable runnable, final Component c) {
8695
try {
8796
LWCToolkit.invokeLater(runnable, c);
@@ -177,7 +186,7 @@ public Boolean call() throws Exception {
177186

178187
return new Boolean(as.isAccessibleChildSelected(index));
179188
}
180-
}, c);
189+
}, c, false);
181190
}
182191

183192
public static AccessibleStateSet getAccessibleStateSet(final AccessibleContext ac, final Component c) {
@@ -199,7 +208,7 @@ public Boolean call() throws Exception {
199208
if (ass == null) return null;
200209
return ass.contains(as);
201210
}
202-
}, c);
211+
}, c, false);
203212
}
204213

205214
static Field getAccessibleBundleKeyFieldWithReflection() {
@@ -265,7 +274,7 @@ public static int getCharCount(final AccessibleText at, final Component c) {
265274
public Integer call() throws Exception {
266275
return at.getCharCount();
267276
}
268-
}, c);
277+
}, c, 0);
269278
}
270279

271280
// Accessibility Threadsafety for JavaComponentAccessibility.m
@@ -290,7 +299,7 @@ public Integer call() throws Exception {
290299
if (ac == null) return null;
291300
return ac.getAccessibleIndexInParent();
292301
}
293-
}, c);
302+
}, c, -1);
294303
}
295304

296305
public static AccessibleComponent getAccessibleComponent(final Accessible a, final Component c) {
@@ -386,7 +395,7 @@ public Boolean call() throws Exception {
386395

387396
return aComp.isFocusTraversable();
388397
}
389-
}, c);
398+
}, c, false);
390399
}
391400

392401
public static Accessible accessibilityHitTest(final Container parent, final float hitPointX, final float hitPointY) {
@@ -443,7 +452,7 @@ public Boolean call() throws Exception {
443452

444453
return aComp.isEnabled();
445454
}
446-
}, c);
455+
}, c, false);
447456
}
448457

449458
// KCH - can we make this a postEvent instead?

‎src/macosx/classes/sun/lwawt/macosx/CAccessible.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ protected synchronized void dispose() {
9696

9797
@Override
9898
public AccessibleContext getAccessibleContext() {
99-
return accessible.getAccessibleContext();
99+
return accessible != null ? accessible.getAccessibleContext() : null;
100100
}
101101

102102
// currently only supports text components

‎src/macosx/native/sun/awt/JavaComponentAccessibility.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,9 @@ + (JavaComponentAccessibility *)createWithAccessible:(jobject)jaccessible withEn
323323
{
324324
jobject jcomponent = [(AWTView *)view awtComponent:env];
325325
jint index = JNFCallStaticIntMethod(env, sjm_getAccessibleIndexInParent, jaccessible, jcomponent);
326-
NSString *javaRole = getJavaRole(env, jaccessible, jcomponent);
326+
if (index < 0) return nil;
327327

328+
NSString *javaRole = getJavaRole(env, jaccessible, jcomponent);
328329
return [self createWithAccessible:jaccessible role:javaRole index:index withEnv:env withView:view];
329330
}
330331

@@ -663,8 +664,8 @@ - (NSUInteger)accessibilityIndexOfChild:(id)child
663664
if (![[self accessibilityRoleAttribute] isEqualToString:NSAccessibilityListRole]) {
664665
return [super accessibilityIndexOfChild:child];
665666
}
666-
667-
return JNFCallStaticIntMethod([ThreadUtilities getJNIEnv], sjm_getAccessibleIndexInParent, ((JavaComponentAccessibility *)child)->fAccessible, ((JavaComponentAccessibility *)child)->fComponent);
667+
jint index = JNFCallStaticIntMethod([ThreadUtilities getJNIEnv], sjm_getAccessibleIndexInParent, ((JavaComponentAccessibility *)child)->fAccessible, ((JavaComponentAccessibility *)child)->fComponent);
668+
return index >= 0 ? index : 0;
668669
}
669670

670671
// Without this optimization accessibilityChildrenAttribute is called in order to get the entire array of children.

0 commit comments

Comments
 (0)
This repository has been archived.