Skip to content

Commit

Permalink
8298643: JNI call of getAccessibleRowWithIndex and getAccessibleColum…
Browse files Browse the repository at this point in the history
…nWithIndex on a wrong thread

Reviewed-by: serb, kizune
  • Loading branch information
savoptik committed Dec 23, 2022
1 parent da75de3 commit fd746a2
Showing 1 changed file with 10 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,28 +88,20 @@ - (id)getTableInfo:(jint)info

- (int)accessibleRowAtIndex:(int)index
{
JNIEnv *env = [ThreadUtilities getJNIEnv];
jobject axContext = [self axContextWithEnv:env];
if (axContext == NULL) return 0;
jclass clsInfo = (*env)->GetObjectClass(env, axContext);
DECLARE_METHOD_RETURN(jm_getAccessibleRowAtIndex, clsInfo, "getAccessibleRowAtIndex", "(I)I", -1);
jint rowAtIndex = (*env)->CallIntMethod(env, axContext, jm_getAccessibleRowAtIndex, (jint)index);
CHECK_EXCEPTION();
(*env)->DeleteLocalRef(env, axContext);
return (int)rowAtIndex;
int columnCount = [self accessibilityColumnCount];
if (columnCount != 0) {
return index / columnCount;
}
return -1;
}

- (int)accessibleColumnAtIndex:(int)index
{
JNIEnv *env = [ThreadUtilities getJNIEnv];
jobject axContext = [self axContextWithEnv:env];
if (axContext == NULL) return 0;
jclass clsInfo = (*env)->GetObjectClass(env, axContext);
DECLARE_METHOD_RETURN(jm_getAccessibleColumnAtIndex, clsInfo, "getAccessibleColumnAtIndex", "(I)I", -1);
jint columnAtIndex = (*env)->CallIntMethod(env, axContext, jm_getAccessibleColumnAtIndex, (jint)index);
CHECK_EXCEPTION();
(*env)->DeleteLocalRef(env, axContext);
return (int)columnAtIndex;
int columnCount = [self accessibilityColumnCount];
if (columnCount != 0) {
return index % columnCount;
}
return -1;
}

- (BOOL) isAccessibleChildSelectedFromIndex:(int)index
Expand Down

0 comments on commit fd746a2

Please sign in to comment.