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

Alan Snyder javalists at cbfiddle.com
Wed Apr 12 13:05:50 UTC 2023


Isn’t there a deeper issue here?

I ran into a problem trying to analyze an image using a filter. The code was waiting for ALLBITS to be reported (as well as ERROR conditions), but for an animated GIF that never happens. I worked around that problem by stopping when a FRAME was reported, which was good enough for my purposes.

I did not see any way to indicate that I did not want an animation or to determine when every frame had been produced once.

Did I miss something?

There are many places where ALLBITS is tested. Are all of these places at risk when operating on an animated GIF?

Implementing animation by simulating an image of infinite size seems like a bad idea, to put it mildly.





> On Apr 11, 2023, at 9:19 PM, Jayathirth D V <jdv at openjdk.org> wrote:
> 
> On Mon, 10 Apr 2023 21:32:30 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.
> 
> Instead of using .gif image as input, its better if we can create ImageStream as we do in some of animation tests under test/jdk/javax/imageio/plugins/gif.
> 
> -------------
> 
> Changes requested by jdv (Reviewer).
> 
> PR Review: https://git.openjdk.org/jdk/pull/13414#pullrequestreview-1380444337
> 




More information about the client-libs-dev mailing list