Name: ssR10077 Date: 03/24/2003
###@###.###
The following test case leaks about 1600 GDI objects. Bug is reproducible
only with Windows L&F. With Metal L&F it eats <100 GDI objects.
import java.io.*;
import java.awt.*;
import javax.swing.*;
public class Test {
public static void main(String[] args) throws Throwable {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel
");
new Test();
}
public Test() {
JFrame frame = new JFrame();
frame.setSize(500,500);
frame.show();
for (int i = 0; i < 20; i++) {
JFileChooser chooser = new JFileChooser();
frame.getContentPane().add(chooser);
frame.validate();
frame.repaint();
try { Thread.sleep(10); } catch (Throwable e) {};
frame.getContentPane().remove(chooser);
frame.validate();
frame.repaint();
try { Thread.sleep(10); } catch (Throwable e) {};
System.gc();
System.gc();
}
}
}
======================================================================