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

[Base, Events] addEventListener Memory Leak on Grand Parent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P5 P5
    • 8u20
    • 7u7
    • javafx
    • None

      The anonymous inner class is not released here, causing a memory leak.
      anchorPane is an AnchorPane, while grandParentButton and someButtonInsideAnchorPane are Buttons.

      anchorPane.getParent().getParent().lookup("#grandParentButton").addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
              @Override
              public void handle(KeyEvent e) {
                  if (e.getCode() == KeyCode.ENTER) {
                      someButtonInsideAnchorPane.requestFocus();
                      e.consume();
                  }
              }
          });

            msladecek Martin Sládeček
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: