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

Jeremy Wood has updated the pull request incrementally with seven additional 
commits since the last revision:

 - 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

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

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

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

  Stats: 79 lines in 1 file changed: 42 ins; 31 del; 6 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