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

Rajat Mahajan rmahajan at openjdk.org
Wed Apr 19 16:37:56 UTC 2023


> **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 three additional commits since the last revision:

 - Update test/jdk/javax/imageio/plugins/gif/6176679/CopyAnimatedGIFTest.java
   
   Co-authored-by: Alexey Ivanov <alexey.ivanov at oracle.com>
 - Update src/java.desktop/share/classes/sun/awt/image/ImageRepresentation.java
   
   Co-authored-by: Alexey Ivanov <alexey.ivanov at oracle.com>
 - Update src/java.desktop/share/classes/sun/awt/image/ImageRepresentation.java
   
   Co-authored-by: Alexey Ivanov <alexey.ivanov at oracle.com>

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/13414/files
  - new: https://git.openjdk.org/jdk/pull/13414/files/ea200b96..c8bd3d99

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=13414&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13414&range=01-02

  Stats: 6 lines in 2 files changed: 0 ins; 3 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/13414.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13414/head:pull/13414

PR: https://git.openjdk.org/jdk/pull/13414



More information about the client-libs-dev mailing list