- Timestamp:
- 2026-01-14T21:32:17+01:00 (41 hours ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/MapImage.java
r18388 r19461 38 38 * ImageIcon can change while the image is loading. 39 39 */ 40 private Image img; 40 private volatile Image img; 41 41 private ImageResource imageResource; 42 42 … … 80 80 * A cache that holds a disabled (gray) version of this image 81 81 */ 82 private BufferedImage disabledImgCache; 82 private volatile BufferedImage disabledImgCache; 83 83 84 84 /** … … 142 142 // This should fix #21919: NPE due to disabledImgCache being null (race condition with #loadImage()) 143 143 synchronized (this) { 144 Image disImg = GuiHelper.getDisabledImage(img); 145 if (disImg instanceof BufferedImage) { 146 disabledImgCache = (BufferedImage) disImg; 147 } else { 148 disabledImgCache = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); 149 Graphics g = disabledImgCache.getGraphics(); 150 g.drawImage(disImg, 0, 0, null); 151 g.dispose(); 144 if(disabledImgCache != null) { 145 Image disImg = GuiHelper.getDisabledImage(img); 146 if (disImg instanceof BufferedImage) { 147 disabledImgCache = (BufferedImage) disImg; 148 } else { 149 disabledImgCache = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); 150 Graphics g = disabledImgCache.getGraphics(); 151 g.drawImage(disImg, 0, 0, null); 152 g.dispose(); 153 } 152 154 } 153 155 }
Note:
See TracChangeset
for help on using the changeset viewer.
