On Fri, 31 Mar 2023 18:52:08 GMT, Sergey Bylokhov <[email protected]> wrote:

>> Please review this PR which suggests to skip updateIconImages() for not yet 
>> visible windows. The displayChanged notification can be sent to a window 
>> that is in the process of initiailization and calling updateIconImages() may 
>> lead to the deadlock.
>> 
>> Testing: the deadlock no longer happens with this patch. The reg test for 
>> JDK-8276849 works (window icon is updated after changing DPI settings).
>
> src/java.desktop/windows/classes/sun/awt/windows/WWindowPeer.java line 605:
> 
>> 603:         if (((Window)target).isVisible()) {
>> 604:             updateIconImages();
>> 605:         }
> 
> Will we call "updateIconImages" when later we show the window or an update of 
> the icons will be missed if the notification come when the window is 
> invisible?
> 
> Are you sure that it is not possible to trigger the next "trace" in the 
> application w/o using "updateIconImages"?
> 
>       at 
> sun.java2d.loops.GraphicsPrimitiveMgr.initIDs(java.desktop@21-ea/Native 
> Method)
>       - waiting on the Class initialization monitor for sun.java2d.loops.Blit
>       at 
> sun.java2d.loops.GraphicsPrimitiveMgr.<clinit>(java.desktop@21-ea/GraphicsPrimitiveMgr.java:56)
>       at sun.java2d.loops.DrawLine.locate(java.desktop@21-ea/DrawLine.java:51)
>       at 
> sun.java2d.SurfaceData.makeRenderLoops(java.desktop@21-ea/SurfaceData.java:884)
>       at 
> sun.awt.image.BufImgSurfaceData.getSolidLoops(java.desktop@21-ea/BufImgSurfaceData.java:412)
>       - locked <0x00000000c3fdd920> (a java.lang.Class for 
> sun.awt.image.BufImgSurfaceData)
>       at 
> sun.awt.image.BufImgSurfaceData.initSolidLoops(java.desktop@21-ea/BufImgSurfaceData.java:397)
>       at 
> sun.awt.image.BufImgSurfaceData.createData(java.desktop@21-ea/BufImgSurfaceData.java:256)
>       at 
> sun.awt.image.BufImgSurfaceData.createData(java.desktop@21-ea/BufImgSurfaceData.java:74)
>       at 
> sun.awt.image.BufImgSurfaceManager.<init>(java.desktop@21-ea/BufImgSurfaceManager.java:55)
>       at 
> sun.awt.image.SurfaceManager.getManager(java.desktop@21-ea/SurfaceManager.java:79)
>       at 
> sun.java2d.SurfaceData.getPrimarySurfaceData(java.desktop@21-ea/SurfaceData.java:275)
>       at 
> sun.java2d.SunGraphicsEnvironment.createGraphics(java.desktop@21-ea/SunGraphicsEnvironment.java:132)
>       at 
> java.awt.image.BufferedImage.createGraphics(java.desktop@21-ea/BufferedImage.java:1183)
>       at 
> sun.awt.SunToolkit.getScaledIconImage(java.desktop@21-ea/SunToolkit.java:1032)
>       at 
> sun.awt.SunToolkit.getScaledIconData(java.desktop@21-ea/SunToolkit.java:1046)
>       at 
> sun.awt.windows.WWindowPeer.updateIconImages(java.desktop@21-ea/WWindowPeer.java:468)
>       at 
> sun.awt.windows.WWindowPeer.updateGC(java.desktop@21-ea/WWindowPeer.java:603)

It seems that the root cause is a cyclic dependency between 
GraphicsPrimitiveMgr and Blit during static initialization

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13263#discussion_r1154801101

Reply via email to