Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8293916

Slider generates NullPointerException - this.dragStart

XMLWordPrintable

    • x86_64
    • linux

      A DESCRIPTION OF THE PROBLEM :
      The StackTrace of this problem is similar to the one in these problems: JDK-8095717 and JDK-8190411
      But we don't use the Slider in combination with a ComboBox, nor do we use a ToolTip.

      When we use Windows 10, the error does not occur. However, when we use Debian with a touchscreen, the error occurs, but rarely. And even then only the first time we use the slider. If the slider has already been used without the error occurring, it will not occur afterwards.

      ----

      The following code snippet is from the SliderSkin class:

              thumb.setOnMousePressed(me -> {
                  behavior.thumbPressed(me, 0.0f);
                  dragStart = thumb.localToParent(me.getX(), me.getY());
                  preDragThumbPos = (getSkinnable().getValue() - getSkinnable().getMin()) /
                          (getSkinnable().getMax() - getSkinnable().getMin());
              });

              thumb.setOnMouseReleased(me -> {
                  behavior.thumbReleased(me);
              });

              thumb.setOnMouseDragged(me -> {
                  Point2D cur = thumb.localToParent(me.getX(), me.getY());
                  double dragPos = (getSkinnable().getOrientation() == Orientation.HORIZONTAL) ?
                          cur.getX() - dragStart.getX() : -(cur.getY() - dragStart.getY());
                  behavior.thumbDragged(me, preDragThumbPos + dragPos / trackLength);
              });

      We suspect that possibly due to timing problems the 'setOnMouseDragged()' is called first and then the 'setOnMousePressed()', which leads to the fact that startDrag is still null.


      FREQUENCY : rarely


            pnarayanaswa Praveen Narayanaswamy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: