Integrated: 8275720: CommonComponentAccessibility.createWithParent isWrapped causes mem leak

Anton Tarasov ant at openjdk.java.net
Tue Oct 26 15:51:52 UTC 2021


On Fri, 22 Oct 2021 16:02:32 GMT, Anton Tarasov <ant at openjdk.org> wrote:

> This is a reimplementation of the `isWrapped` logic in the method:
> 
> `+[CommonComponentAccessibility createWithParent:accessible:role:index:withEnv:withView:isWrapped:]`
> 
> The `isWrapped` arg was used to create an a11y element which is wrapped into an object that does not have direct peer in Java (like `ListRowAccessibility`, `TableRowAccessibility`). The problem is that such objects leak, because when the wrapped element is created (`isWrapped == YES`), the native pointer to the element is rewritten in the associated java peer (the `accessible` arg) and the element object is then released via the `CFRetainedResource` mechanism. However the wrapping object (`ListRowAccessibility`, `TableRowAccessibility`) is never released.
> 
> This fix proposes a dedicated class for creating such paired objects, where a wrapper object releases its wrapped child when the deallocation is triggered by garbage collecting the associated java peer.

This pull request has now been integrated.

Changeset: 574f8903
Author:    Anton Tarasov <ant at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/574f8903ee1f74bdf7154d670d96c36d94b38b4d
Stats:     186 lines in 10 files changed: 109 ins; 52 del; 25 mod

8275720: CommonComponentAccessibility.createWithParent isWrapped causes mem leak

Reviewed-by: kizune, pbansal

-------------

PR: https://git.openjdk.java.net/jdk/pull/6081



More information about the client-libs-dev mailing list