src/share/classes/sun/awt/image/VolatileSurfaceManager.java

Print this page

        

@@ -326,19 +326,22 @@
     public void displayChanged() {
         if (!isAccelerationEnabled()) {
             return;
         }
         lostSurface = true;
+        //TODO: Access to the sdAccel SHOULD be synchronized. The following
+        //      assignment is a temporary workaround to avoid NPEs.
+        SurfaceData sdAccel = this.sdAccel;
         if (sdAccel != null) {
             // First, nullify the software surface.  This guards against
             // using a SurfaceData that was created in a different
             // display mode.
             sdBackup = null;
             sdCurrent = getBackupSurface();
             // Now, invalidate the old hardware-based SurfaceData
             SurfaceData oldData = sdAccel;
-            sdAccel = null;
+            this.sdAccel = null;
             oldData.invalidate();
         }
         // Update graphicsConfig for the vImg in case it changed due to
         // this display change event
         vImg.updateGraphicsConfig();