Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4745575
Votes 2
Synopsis 1.4.0 REGRESSION: Windows GDI resource leak when using JFileChooser with Windows
Category java:classes_awt
Reported Against 1.4 , 1.4.1 , merlin-beta3
Release Fixed 1.4.2(mantis)
State 10-Fix Delivered, bug
Priority: 3-Medium
Related Bugs 4622892 , 4711700
Submit Date 11-SEP-2002
Description




FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]

ADDITIONAL OPERATING SYSTEMS :
WIN98 (and I guess on all windows platforms)


A DESCRIPTION OF THE PROBLEM :
The problem is that when using a JFileChooser with a
Windows L&F (WindowsFileChooserUI), there is a GDI resource
leak when traversing the filesystem. Whenever a new
directory is browsed, more GDI resources are consumed,
never to be released before the process terminates. The
JFileChooser dialog can be opened and closed many times,
but the leak remains and grows with each new directory that
is browsed. This bug DOES NOT exist if the
MetalFileChooserUI is used.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Simply run FileChooserDemo
2. Switch to Windows L&F
3. Open the dialog. With each new directory that is
browsed, more GDI resources are consumed (no new GDI
resources are consumed if you return to a directory that
you had already been in). This leak can be easily seen
with Windows' task manager, adding "GDI Objects" to the
viewed columns.
4. You may close and open the dialog several times and see
that the leak remains (with the task manager) until the
process terminates.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Just run the FileChooserDemo that comes with the SDK, and follow the steps I
described before.
---------- END SOURCE ----------

CUSTOMER WORKAROUND :
The only workaround I can think of is using
MetalFileChooserUI instead of WindowsFileChooserUI. Of
course this is not a good one, since I want to see the
Windows L&F.
(Review ID: 163882) 
======================================================================
Work Around
N/A
Evaluation
Will fix for next release.
 xxxxx@xxxxx  2002-09-11




 xxxxx@xxxxx  2002-09-27
Problem is inside src/windows/native/sun/windows/ShellFolder.cpp
Java_sun_awt_shell_Win32ShellFolder_getIconBits
calls GetIconInfo but doesn't release returned bitmaps

======================================================================
Comments
  
  Include a link with my name & email   

Submitted On 24-SEP-2002
paul_kent2
You can also choose to use the AWT File Chooser if you wish 
to have the Windows Look and feel. You can use the AWT 
File dialog even though you are using Swing since a File dialog 
is modal, it shouldn't affect the rest of the application.


Submitted On 31-DEC-2002
mikemjl
This is not fixed in JDK1.4.1_01  !!!  When and what version 
will it be fixed in. It causes my whole windows 2000 OS to go 
into a fatal loop trying to paint all the frames


Submitted On 23-JAN-2003
jcloughley
mantis is the code name for 1.4.2.  Sun's site says 
the "beginning of 2003".


Submitted On 05-FEB-2004
iandevlin
This is also not fixed for 1.5 Beta 1!!!



PLEASE NOTE: JDK6 is formerly known as Project Mustang