<AWT Dev> Code Review Request for CR 7128738 - dragged dialog freezes system on dispose

Oleg Pekhovskiy oleg.pekhovskiy at oracle.com
Fri Mar 16 11:14:17 PDT 2012

Hi Anthony,

referring to 'waitForIdle()' method, as I understand, you're talking 
about platforms other than Windows, because it works as expected here. 
Nevertheless, I added 1-sec delays between functional calls to guarantee 
the proper testing on all platforms.
And also moved the test to 'test/java/awt/Frame'.

Please, take a look at the final webrev:

Thank you,

3/16/2012 4:07 PM, Anthony Petrov wrote:
> Hi Oleg,
> The test is good, although I suggest to insert manual delays (of 
> 500...1500 ms) between showing frames, clicking, calling dispose(), 
> etc. Unfortunately, the waitForIdle() alone doesn't guarantee much 
> when it comes to processing native events.
> Also, the test doesn't belong to the DnD area since the issue isn't 
> related to the AWT DnD API. The test should be in java/awt/Frame/ 
> directory with the "toplevel" area.
> But otherwise the changes look fine, so provided the above suggestions 
> are applied, I'm approving the fix. Thanks!
> -- 
> best regards,
> Anthony
> On 3/15/2012 12:54 AM, Oleg Pekhovskiy wrote:
>> Hi Anthony,
>> thanks you for your proposal!
>> Freezing behavior occurs only until JVM finishes, when all other java 
>> objects are disposed.
>> In example provided in CR's evaluation field the primary frame 
>> prevents JVM from finishing, that causes freezing.
>> So, the test, I propose, disposes the primary frame, that eliminates 
>> freezing:
>> http://cr.openjdk.java.net/~bagiras/8/7128738.2
>> Thanks,
>> Oleg
>> 3/14/2012 6:16 AM, Anthony Petrov wrote:
>>> Hi Oleg,
>>> The fix looks good to me. It would be cool to write a regression 
>>> test for the issue, btw. You could start dragging a frame using 
>>> Robot, and then call dispose() a couple seconds before releasing a 
>>> mouse button. The test would fail by time-out w/o the fix.
>>> -- 
>>> best regards,
>>> Anthony
>>> On 3/14/2012 1:54 AM, Oleg Pekhovskiy wrote:
>>>> Hi guys,
>>>> please review the fix for:
>>>> http://bugs.sun.com/view_bug.do?bug_id=7128738
>>>> webrev:
>>>> http://cr.openjdk.java.net/~bagiras/7128738.1
>>>> Description:
>>>> Entering 'move window' mode clicking window title bar sends 
>>>> As a result additional message pump (for mouse capture) is created 
>>>> blocking the handlers' chain WM_NCLBUTTONDOWN -> WM_SYSCOMMAND.
>>>> So when JFrame.dispose() is called during this situation, deleting 
>>>> of native AwtFrame object could NOT be done because 
>>>> AwtComponent::CanBeDeleted() returns FALSE
>>>> (because of WM_NCLBUTTONDOWN & WM_SYSCOMMAND) and 
>>>> WM_AWT_DELETEOBJECT message is reposted over and over again (eating 
>>>> CPU time).
>>>> Thus I added ReleaseDragCapture(0) to AwtComponent::Dispose() to 
>>>> release mouse capture and finish the additional message pump
>>>> so that AwtComponent::CanBeDeleted() returns TRUE and AwtFrame 
>>>> object is deleted.
>>>> Thanks,
>>>> Oleg

More information about the awt-dev mailing list