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

Rajat Mahajan rmahajan at openjdk.org
Mon Apr 17 18:52:13 UTC 2023


On Fri, 14 Apr 2023 22:48:41 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:
> 
>   code cleanup and test changes as requested in code review

> 



> _Mailing list message from [Alan Snyder](mailto:javalists at cbfiddle.com) on [client-libs-dev](mailto:client-libs-dev at mail.openjdk.org):_
> 
> > On Apr 14, 2023, at 3:48 PM, Rajat Mahajan <rmahajan at openjdk.org> wrote:
> > > 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.
> 
> Is it really the case that multiple frames are copied one at a time?
> 
> I don?t see that, and don?t see how that could work.
> 
> I?m not saying it is wrong to copy only the first frame, as that is the only reasonable option if the goal is to transfer a BufferedImage.
> 
> I assume there is no Java representation of a multi-frame image that could be copied?
> 
> -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://mail.openjdk.org/pipermail/client-libs-dev/attachments/20230414/582a7883/attachment.htm>

Yes I see that the frame is copied one at a time. When I debug and step in reconstruct() is called per frame.
I am not aware of Java representation of a multi-frame image.

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

PR Comment: https://git.openjdk.org/jdk/pull/13414#issuecomment-1511908141



More information about the client-libs-dev mailing list