Re: RFR: 8279640: ListView with null SelectionModel/FocusModel throws NPE

2022-01-11 Thread John Hendrikx
On Sat, 8 Jan 2022 00:17:36 GMT, Marius Hanl wrote: > This PR fixes a bunch of NPEs when a null `SelectionModel` or `FocusModel` is > set on a `ListView`. > > The following NPEs are fixed (all are also covered by exactly one test case): > NPEs with null selection model: > - Mouse click on a

Re: RFR: 8279640: ListView with null SelectionModel/FocusModel throws NPE

2022-01-11 Thread Marius Hanl
On Sat, 8 Jan 2022 14:32:30 GMT, John Hendrikx wrote: > Same goes for the selection model; if set to `null` it should not allow any > kind of selection, which again seems best achieved by installing a model that > ignores all such actions and always returns empty values. We had a similar

Re: RFR: 8279640: ListView with null SelectionModel/FocusModel throws NPE

2022-01-11 Thread Marius Hanl
On Tue, 11 Jan 2022 09:01:51 GMT, John Hendrikx wrote: > ``` > public final MultipleSelectionModel getSelectionModel() { > return selectionModel == null ? null : > selectionModel.get() == NONE_SELECTION_MODEL ? null : > selectionModel.get(); > } > ``` That would work altough I

Re: RFR: 8279640: ListView with null SelectionModel/FocusModel throws NPE

2022-01-11 Thread Michael Strauß
On Tue, 11 Jan 2022 13:04:52 GMT, Marius Hanl wrote: > When a null value is possible, guards against are needed. Unfortunately there > is no built-in way to forbid null in Java as whole. I think null checks should only be done to verify the preconditions of an operation, and not to guard

Re: RFR: 8277848 Binding and Unbinding to List leads to memory leak [v4]

2022-01-11 Thread Florian Kirmaier
> Making the initial listener of the ListProperty weak fixes the problem. > The same is fixed for Set and Map. > Due to a smart implementation, this is done without any performance drawback. > (The trick is to have an object, which is both the WeakReference and the > Changelistener) > By implying

Re: RFR: 8277848 Binding and Unbinding to List leads to memory leak [v3]

2022-01-11 Thread Florian Kirmaier
On Wed, 5 Jan 2022 18:14:44 GMT, Florian Kirmaier wrote: >> Making the initial listener of the ListProperty weak fixes the problem. >> The same is fixed for Set and Map. >> Due to a smart implementation, this is done without any performance drawback. >> (The trick is to have an object, which is

RFR: 8244234: MenuButton: NPE on removing from scene with open popup

2022-01-11 Thread eduardsdv
The NPE occurs when the skinnable is removed from the scene while the popup is showing. The MenuButtonSkinBase, when popup becomes hidden, tries to remove Mnemonics from the scene and runs into NPE. To avoid NPE a null-check is added to the 'showing' listener. Since the mnemonics cannot be

RFR: 8242544: CMD+ENTER key event crashes the application when invoked on dialog

2022-01-11 Thread Martin Fox
The OS crashes if the contentView of a window is set to nil while handling processKeyEquivalent. With this PR we just set the contentView to a basic do-nothing NSView for the interim. - Commit messages: - Prevent OS crash when contentView is set to nil while processing shortcut

Re: RFR: 8242544: CMD+ENTER key event crashes the application when invoked on dialog

2022-01-11 Thread Martin Fox
On Wed, 29 Dec 2021 00:44:44 GMT, Andreas Heger wrote: > This also solves [JDK-8205915 [macOS] Accelerator assigned to button in > dialog fires menuItem in owning > stage](https://bugs.openjdk.java.net/browse/JDK-8205915l). > > I must admit that I don't have 100% insight about what actually

Re: RFR: 8242544: CMD+ENTER key event crashes the application when invoked on dialog

2022-01-11 Thread Kevin Rushforth
On Tue, 11 Jan 2022 22:18:53 GMT, Martin Fox wrote: > The OS crashes if the contentView of a window is set to nil while handling > processKeyEquivalent. With this PR we just set the contentView to a basic > do-nothing NSView for the interim. Note: This PR proposes an alternative fix to the