> This PR automatically calls CAccessible.dispose() as Components are removed 
> from the AWT hierarchy. Then as Components are readded later: we recreate a 
> new CAccessible.
> 
> I couldn't figure out how CAccessible.dispose() was ever meant to be called 
> before. (It exists because CFRetainedResource#dispose() exists.) I added 
> debugger breakpoints and never saw it invoked.
> 
> This PR focuses on the life cycle of a CAccessible, so it also adds logic in 
> the dispose() method to remove a listener and nullify cached info.
> 
> I don't have a great understanding of this area of code / subject matter, but 
> this appears to resolve #8381236.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Jeremy Wood has updated the pull request with a new target base due to a merge 
or a rebase. The incremental webrev excludes the unrelated changes brought in 
by the merge/rebase. The pull request contains 11 additional commits since the 
last revision:

 - 8381236: updating propertyChange vars
   
   This is in response to:
   https://github.com/openjdk/jdk/pull/30578/changes#r3120285255
 - Merge branch 'master' into 8381236
 - 8381236: fixing whitespace
 - 8381236: remove AXChangeNotifier after dispose
   
   This PR really focuses on controlling the lifecycle of a CAccessible, so if 
we're encouraging them to be disposed more often: we should also uninstall our 
listeners.
 - 8381236: tweak comment
 - 8381236: make new method private
 - 8381236: remove unused import
 - 8381236: move static field above non-static fields
 - 8381236: refactor to use "ancestor" listener
   
   Using "ancestor" listener makes a little more sense: each individual 
component can dispose of its own CAccessible. (Instead of relying on a parent 
to dispose its descendants recursively.)
   
   Also I poked around with debugger breakpoints and realized CAccessibles are 
not automatically getting recreated as quickly as I'd like so:
   A. I recreate them myself when the Component is reattached to a hierarchy
   B. I cleared the cache (setNativeAXResource(null)) to make sure the new 
CAccessible gets used
 - 8381236: add unit test
 - ... and 1 more: https://git.openjdk.org/jdk/compare/0e58fa6f...26135316

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/30578/files
  - new: https://git.openjdk.org/jdk/pull/30578/files/1637ce67..26135316

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=30578&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=30578&range=01-02

  Stats: 131205 lines in 3147 files changed: 70429 ins; 33493 del; 27283 mod
  Patch: https://git.openjdk.org/jdk/pull/30578.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/30578/head:pull/30578

PR: https://git.openjdk.org/jdk/pull/30578

Reply via email to