JDK-6988428 : Shape is not applied sometimes
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_vista
  • CPU: x86
  • Submitted: 2010-09-29
  • Updated: 2011-03-07
  • Resolved: 2011-03-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b120Fixed
Related Reports
Relates :  
Description
During test execution I noticed that sometimes shape is not applied to the window. So I created this test code (attached) which does nothing but creates JFrame with shape applied and checks whether it is really applied. If everything ok it disposes the frame and tries again.

On first run it failed on attempt #33. But for test execution it could be second or third window actually, so it doesn't seem to be related to memory leaks etc. It's rather race condition or something other random.

Windows Vista Aero

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/build/jdk/rev/f6f2989e547f
04-12-2010

EVALUATION Looks like the problem is really threading-related. By placing the call to ::SetWindowRgn() to the toolkit thread, the problem disappears (I've run the test several times, about 300-400 attempts to set the shape succeded w/o problems).
21-10-2010

EVALUATION It's been noticed that the shape set initially doesn't get applied correcly sometimes. The Java tutorial recommends setting the shape in the componentResized() method of the ComponentListener attached to the window: http://download.oracle.com/javase/tutorial/uiswing/misc/trans_shaped_windows.html Following this practice should workaround the issue.
30-09-2010