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

Unintentional memory retention in GridBagLayout

    XMLWordPrintable

Details

    • 1.2.2
    • generic, x86, sparc
    • generic, solaris_2.6, windows_nt

    Description

      GridBagLayout adds any component handed to it via the addLayoutComponent
      method to an internal hashtable. It does nothing upon the invocation of
      removeLayoutComponent.

      Thus,

      JFrame frame = new JFrame("Test");
      frame.getContentPane().setLayout(new GridBagLayout());
      frame.getContentPane().add(componentA);
      frame.getContentPane().add(componentB);
      frame.getContentPane().add(componentC);
      frame.getContentPane().remove(componentA);
      frame.getContentPane().remove(componentB);
      frame.getContentPane().remove(componentC);

      // At the end, the container content pane no longer has any references
      // to the components, but there are references to the three components
      // in the comptable hashtable in the GridBagLayout component

      janet.koenig@Eng 1998-08-28

      Attachments

        Issue Links

          Activity

            People

              dmendenhsunw David Mendenhall (Inactive)
              jkoenigsunw Janet Koenig (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: