RFR: 6176679: Application freezes when copying an animated gif image to the system clipboard [v13]

Alexey Ivanov aivanov at openjdk.org
Thu May 4 17:11:24 UTC 2023


On Wed, 3 May 2023 03:36:25 GMT, Rajat Mahajan <rmahajan at openjdk.org> wrote:

>> **Problem:**
>> 
>> On pressing the Copy button we keep waiting in AWT-EventQueue thread in reconstruct() function as we detect that we have missing information for the animated image since we are copying single frame at a time.
>> Due to this infinite wait the application freezes.
>> 
>> **Proposed Fix:**
>> 
>> There are conditions in the reconstruct() function that avoid entering the wait() code if we have some error reading the image , etc. So, I added the condition to avoid entering the wait() code if we are copying single frame at a time. This sounded logical to me since if we have incomplete information(single frame) about the animated image we shouldn’t keep waiting, as it leads to infinite wait. 
>> After this change I see the GIF image being correctly copied and animated.
>> 
>> 
>> **Testing:**
>> 
>> Added a test for this (bug6176679.java) and tested locally on my Windows machine and on mach5.
>
> Rajat Mahajan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   make code changes suggested by reviewers

Looks good to me now.

You have to address the trailing whitespace error too.

test/jdk/java/awt/Clipboard/CopyAnimatedGIFTest.java line 106:

> 104: 
> 105:         robot.waitForIdle();
> 106:         robot.delay(1000);

Robot is needed only when UI is displayed, so it could be moved inside the `if (isImageDisplayed)` block.

-------------

Marked as reviewed by aivanov (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13414#pullrequestreview-1413537844
PR Review Comment: https://git.openjdk.org/jdk/pull/13414#discussion_r1185287383



More information about the client-libs-dev mailing list