Changeset 10239 in josm


Ignore:
Timestamp:
2016-05-17T03:35:50+02:00 (9 years ago)
Author:
Don-vip
Message:

see #11002 - add some robustness against JDK bug

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r10078 r10239  
    832832        }
    833833
    834         g.drawImage(offscreenBuffer, 0, 0, null);
     834        try {
     835            g.drawImage(offscreenBuffer, 0, 0, null);
     836        } catch (ClassCastException e) {
     837            // See #11002 and duplicate tickets. On Linux with Java >= 8 Many users face this error here:
     838            //
     839            // java.lang.ClassCastException: sun.awt.image.BufImgSurfaceData cannot be cast to sun.java2d.xr.XRSurfaceData
     840            //   at sun.java2d.xr.XRPMBlitLoops.cacheToTmpSurface(XRPMBlitLoops.java:145)
     841            //   at sun.java2d.xr.XrSwToPMBlit.Blit(XRPMBlitLoops.java:353)
     842            //   at sun.java2d.pipe.DrawImage.blitSurfaceData(DrawImage.java:959)
     843            //   at sun.java2d.pipe.DrawImage.renderImageCopy(DrawImage.java:577)
     844            //   at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:67)
     845            //   at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:1014)
     846            //   at sun.java2d.pipe.ValidatePipe.copyImage(ValidatePipe.java:186)
     847            //   at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3318)
     848            //   at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3296)
     849            //   at org.openstreetmap.josm.gui.MapView.paint(MapView.java:834)
     850            //
     851            // It seems to be this JDK bug, but Oracle does not seem to be fixing it:
     852            // https://bugs.openjdk.java.net/browse/JDK-7172749
     853            //
     854            // According to bug reports it can happen for a variety of reasons such as:
     855            // - long period of time
     856            // - change of screen resolution
     857            // - addition/removal of a secondary monitor
     858            //
     859            // But the application seems to work fine after, so let's just log the error
     860            Main.error(e);
     861        }
    835862        super.paint(g);
    836863    }
Note: See TracChangeset for help on using the changeset viewer.