RFR: 8190411: NPE in SliderSkin:140 if Slider.Tooltip.autohide is true [v5]

Kevin Rushforth kcr at openjdk.org
Tue Dec 6 23:27:29 UTC 2022


On Tue, 6 Dec 2022 11:25:44 GMT, Karthik P K <kpk at openjdk.org> wrote:

>> Cause: When slider is dragged for first time after tooltip appears, setOnMousePressed event was not invoked, hence dragStart was null in the subsequently invoked event handler (setOnMouseDragged).
>> 
>> Fix: Initialized dragStart in initialize method.
>> 
>> Test: Added system test to validate the fix.
>> 
>> Note: Initializing dragStart in layoutChildren method as suggested in the bug was causing side effects. Hence initialized dragStart in initialize method.
>
> Karthik P K has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Address review comment. Add comments for changes

Other than my general concern about not setting the value of a property that is under app control, this looks like it will work, unless the app binds to the property. See my comment inline.

modules/javafx.controls/src/main/java/javafx/scene/control/skin/SliderSkin.java line 404:

> 402:                 // This is done to receive mouse pressed event on thumb and
> 403:                 // inturn to detect start of drag.
> 404:                 t.setConsumeAutoHidingEvents(false);

In general, I'm not in favor of setting the value of a public property (for a few reasons). Have you considered alternative approaches? One thing to note is that this will be ineffective if the app binds to the `consumeAutoHidingEvents` property (unlikely as that might be).

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

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


More information about the openjfx-dev mailing list