Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8274056: JavaAccessibilityUtilities leaks JNI objects
Reviewed-by: aivanov, ant
  • Loading branch information
savoptik authored and Anton Tarasov committed Sep 21, 2021
1 parent 57df0db commit 42d5d2a
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -57,11 +57,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)
Expand Down Expand Up @@ -226,7 +229,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)
Expand Down

7 comments on commit 42d5d2a

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheRealMDoerr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk11u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 42d5d2a Sep 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheRealMDoerr the backport was successfully created on the branch TheRealMDoerr-backport-42d5d2ab in my personal fork of openjdk/jdk11u-dev. To create a pull request with this backport targeting openjdk/jdk11u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

this pull request contains a backport of commit 42d5d2ab from the openjdk/jdk repository.

The commit being backported was authored by Artem Semenov on 21 Sep 2021 and was reviewed by Alexey Ivanov and Anton Tarasov.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk11u-dev:

$ git fetch https://github.com/openjdk-bots/jdk11u-dev TheRealMDoerr-backport-42d5d2ab:TheRealMDoerr-backport-42d5d2ab
$ git checkout TheRealMDoerr-backport-42d5d2ab
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk11u-dev TheRealMDoerr-backport-42d5d2ab

@VladimirKempik
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk15u-dev

@VladimirKempik
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk13u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 42d5d2a Sep 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VladimirKempik the backport was successfully created on the branch VladimirKempik-backport-42d5d2ab in my personal fork of openjdk/jdk15u-dev. To create a pull request with this backport targeting openjdk/jdk15u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

this pull request contains a backport of commit 42d5d2ab from the openjdk/jdk repository.

The commit being backported was authored by Artem Semenov on 21 Sep 2021 and was reviewed by Alexey Ivanov and Anton Tarasov.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk15u-dev:

$ git fetch https://github.com/openjdk-bots/jdk15u-dev VladimirKempik-backport-42d5d2ab:VladimirKempik-backport-42d5d2ab
$ git checkout VladimirKempik-backport-42d5d2ab
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk15u-dev VladimirKempik-backport-42d5d2ab

@openjdk
Copy link

@openjdk openjdk bot commented on 42d5d2a Sep 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VladimirKempik the backport was successfully created on the branch VladimirKempik-backport-42d5d2ab in my personal fork of openjdk/jdk13u-dev. To create a pull request with this backport targeting openjdk/jdk13u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

this pull request contains a backport of commit 42d5d2ab from the openjdk/jdk repository.

The commit being backported was authored by Artem Semenov on 21 Sep 2021 and was reviewed by Alexey Ivanov and Anton Tarasov.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk13u-dev:

$ git fetch https://github.com/openjdk-bots/jdk13u-dev VladimirKempik-backport-42d5d2ab:VladimirKempik-backport-42d5d2ab
$ git checkout VladimirKempik-backport-42d5d2ab
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk13u-dev VladimirKempik-backport-42d5d2ab

Please sign in to comment.