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

Karthik P K duke at openjdk.org
Fri Dec 2 13:44:25 UTC 2022


On Fri, 2 Dec 2022 13:10:37 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:

>> Karthik P K has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Address review comments
>
> modules/javafx.controls/src/main/java/javafx/scene/control/skin/SliderSkin.java line 346:
> 
>> 344:         thumb.getStyleClass().setAll("thumb");
>> 345:         thumb.setAccessibleRole(AccessibleRole.THUMB);
>> 346:         dragStart = new Point2D(thumb.getLayoutX(), thumb.getLayoutY());
> 
> `dragStart` should be the exact mouse position where mouse pressed has occurred.
> With this change mouse gets moved to the layout X, Y position of thumb, even though the mouse press occurred at any other location inside the thumb.

This change makes sure that `dragStart` is not null when `setOnMouseDragged `event handler is called.
As suggested in the issue, I tried to initialize `dragStart` in `layoutChildren` method but it was causing side effects.
I checked for other event handlers such as `onDragDetected` and `onMouseDragEntered`, but none of these event handlers were invoked. Looks like these events are also consumed by tooltip similar to how it consumes `setOnMousePressed`.
I haven't seen above mentioned side effect while checking the fix. I will check again.

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

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


More information about the openjfx-dev mailing list