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

Scene MouseEvent PRESSED and RELEASED references not cleared when expected

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8u20
    • Component/s: javafx
    • Labels:

      Description

      When a node is added to the scene, and removed by the use of an MouseEvent.MOUSE_PRESSED, MouseEvent.MOUSE_RELEASED or MouseEvent.MOUSE_CLICKED. the reference to the node and all the child nodes is kept. It takes a new one of the above events to release these references. Causing to free memory not when a node is not needed anymore, but when a second time the ClickGenerator in Scene.java has kicked in.

      After some searching i came across: http://hg.openjdk.java.net/openjfx/8/master/rt/file/f89b7dc932af/modules/graphics/src/main/java/javafx/scene/Scene.java with the following lines (at 3436 and 3437):

      target.fillHierarchy(pressedTargets);
      pickedTarget.fillHierarchy(releasedTargets);

      pressedTargets and releasedTargets are not cleared after the event has fired (if conditions met or not after an MOUSE_RELEASED).

      I have tested the above using the netbeans profiler with two application snapshots where:
      - I took a snapshot immediately after closing the node (with MOUSE_RELEASED) and did a GC root search on the removed node showing releasedTargets with reference to the class which was the node.
      - and when i did just a click somewhere else in the scene where this node resided and releasedTargets did not had the node/class reference anymore.

        Attachments

          Activity

            People

            Assignee:
            msladecek Martin Sládeček
            Reporter:
            jsirachjfx John Sirach (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: