Skip to content
Permalink
Browse files
8274056: JavaAccessibilityUtilities leaks JNI objects
Backport-of: 42d5d2abaad8a88a5e1326ea8b4494aeb8b5748b
  • Loading branch information
Phil Race committed Sep 27, 2021
1 parent 7b67581 commit d46a5ae71e2d1096646591f33bdebf478236f249
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityUtilities.m
@@ -56,11 +56,14 @@ NSSize getAxComponentSize(JNIEnv *env, jobject axComponent, jobject component)
DECLARE_STATIC_METHOD_RETURN(jm_getSize, sjc_CAccessibility, "getSize",
"(Ljavax/accessibility/AccessibleComponent;Ljava/awt/Component;)Ljava/awt/Dimension;", NSZeroSize);

jobject dimension = (*env)->CallStaticObjectMethod(env, jc_Dimension, jm_getSize, axComponent, component);
jobject dimension = (*env)->CallStaticObjectMethod(env, sjc_CAccessibility, jm_getSize, axComponent, component);
CHECK_EXCEPTION();

if (dimension == NULL) return NSZeroSize;
return NSMakeSize((*env)->GetIntField(env, dimension, jf_width), (*env)->GetIntField(env, dimension, jf_height));

NSSize size = NSMakeSize((*env)->GetIntField(env, dimension, jf_width), (*env)->GetIntField(env, dimension, jf_height));
(*env)->DeleteLocalRef(env, dimension);
return size;
}

NSString *getJavaRole(JNIEnv *env, jobject axComponent, jobject component)
@@ -211,7 +214,9 @@ NSPoint getAxComponentLocationOnScreen(JNIEnv *env, jobject axComponent, jobject
axComponent, component);
CHECK_EXCEPTION();
if (jpoint == NULL) return NSZeroPoint;
return NSMakePoint((*env)->GetIntField(env, jpoint, sjf_X), (*env)->GetIntField(env, jpoint, sjf_Y));
NSPoint p = NSMakePoint((*env)->GetIntField(env, jpoint, sjf_X), (*env)->GetIntField(env, jpoint, sjf_Y));
(*env)->DeleteLocalRef(env, jpoint);
return p;
}

jint getAxTextCharCount(JNIEnv *env, jobject axText, jobject component)

1 comment on commit d46a5ae

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on d46a5ae Sep 27, 2021

Please sign in to comment.