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

TabPane: Memory leak when switching skin

XMLWordPrintable

      just to keep track, a failing test below.

      Didn't dig, just verified that not/removing the listener to selectedItem in dispose (as suggested in fix for JDK-8241737) does not make a difference here.

          public static class TabPaneSkin1 extends TabPaneSkin {

              public TabPaneSkin1(TabPane control) {
                  super(control);
              }
              
          }
          
          /**
           * memory leak when replacing skin
           */
          @Test
          public void testTabPaneSkin() {
              TabPane control = new TabPane();
              ObservableList<String> data = FXCollections.observableArrayList("Apple", "Orange", "Banana");
              data.forEach(text -> control.getTabs().add(new Tab(text)));
              showControl(control);
              WeakReference<?> weakRef = new WeakReference<>(control.getSkin());
              control.setSkin(new TabPaneSkin1(control));
              attemptGC(weakRef, 10);
              assertNull("skin must be gc'ed", weakRef.get());
          }
       

            arapte Ambarish Rapte
            fastegal Jeanette Winzenburg
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: