On Thu, 7 Jul 2022 11:11:27 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

> When we call JDesktopPane.setDesktopManager(new DefaultDesktopManager()) and 
> try to iconify an internalframe, it results in NPE
> 
> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> at 
> javax.swing.RepaintManager.getVolatileOffscreenBuffer(RepaintManager.java:1030)
> at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1489)
> at javax.swing.RepaintManager.paint(RepaintManager.java:1272)
> at javax.swing.JComponent.paint(JComponent.java:1042)
> at javax.swing.JComponent.paintChildren(JComponent.java:889)
> at javax.swing.JComponent.paint(JComponent.java:1065)
> at 
> com.apple.laf.AquaInternalFrameDockIconUI$ScaledImageLabel.updateIcon(AquaInternalFrameDockIconUI.java:193)
> at 
> com.apple.laf.AquaInternalFrameDockIconUI$ScaledImageLabel.paint(AquaInternalFrameDockIconUI.java:204)
> at javax.swing.JComponent.paintChildren(JComponent.java:889)
> at javax.swing.JComponent.paint(JComponent.java:1065)
> at javax.swing.JComponent.paintChildren(JComponent.java:889)
> at javax.swing.JComponent.paint(JComponent.java:1065)
> at javax.swing.JLayeredPane.paint(JLayeredPane.java:586) 
> 
> 
> it seems the RepaintManager.getVolatileOffscreenBuffer() is called with 
> JRootPane component for AquaLookAndFeel because of which 
> SwingUtilities.getWindowAncestor(JRootPane) returns null causing NPE.
> 
> Fixed by adding a null check. The JInternalFrame can be successfully iconized 
> now after setting DesktopManager.

Marked as reviewed by prr (Reviewer).

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

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

Reply via email to