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

TextFlow: listeners on bounds can throw NPE while computing text bounds

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • jfx22
    • jfx17
    • javafx
    • None
    • b20

    Description

      It's "a bit" complicated.
      In some situations, getRuns get's called because listeners on bounds are set.
      This causes TextFlow to layout to compute the runs.
      Afterward, the bounds of the parents get updated.
      This triggers a call to compute bounds - which cascades up to the children.
      When the geometry of the previous Text gets computed in this big stack - it throws an nullpointer.
      The Text doesn't have its runs, and calling TextFlow.layout is now a noop (it detects repeated calls in the same stack)

      In the case it happened - it didn't repair and the application kinda crashed.
      This bug most likely can also be triggered by ScenicView or similar tools, which sets listeners to the bounds.
      It also can cause unpredictable performance issues.

      Unit test and example stacktrace are in the ticket.

      Attachments

        1. stacktrace-textflowbug
          24 kB
          Florian Kirmaier
        2. TextFlowCrashTest.java
          3 kB
          Florian Kirmaier

        Issue Links

          Activity

            People

              fkirmaier Florian Kirmaier
              fkirmaier Florian Kirmaier
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: