There are multiple issues in the `TableMenu` logic that result in a memory leak.

The following problems are now fixed with this PR:
- The listener, that is registered to the `col.visibleProperty()` was not weak 
nor was it ever unregistered
   - The fix is to do pretty much the same that was already done with the 
`col.textProperty()` listener
- The `col.visibleProperty()` and `col.textProperty()` where added again and 
again and again to the column when the columns changed (which happens when 
toggling the visibility).
  - The fix is to add the listeners once - when the `MenuItem` is created. This 
way, when the `TableMenu` is rebuild and the cached `MenuItem` is used, the 
whole listener logic is not run again for the column

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

Commit messages:
 - 8341687: Memory leak in TableView after interacting with TableMenuButton

Changes: https://git.openjdk.org/jfx/pull/1640/files
  Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1640&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8341687
  Stats: 177 lines in 3 files changed: 159 ins; 14 del; 4 mod
  Patch: https://git.openjdk.org/jfx/pull/1640.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1640/head:pull/1640

PR: https://git.openjdk.org/jfx/pull/1640

Reply via email to