RFR: 8275720: CommonComponentAccessibility.createWithParent isWrapped causes mem leak [v2]

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


> 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.

Anton Tarasov has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits:

 - Merge branch 'master' into JDK-8275720
 - 8275720: CommonComponentAccessibility.createWithParent isWrapped causes mem leak

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

Changes: https://git.openjdk.java.net/jdk/pull/6081/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6081&range=01
  Stats: 186 lines in 10 files changed: 109 ins; 52 del; 25 mod
  Patch: https://git.openjdk.java.net/jdk/pull/6081.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/6081/head:pull/6081

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



More information about the client-libs-dev mailing list