7175183: [macosx] Objective-C exception thrown when switching monitor configuration
authorkizune
Thu, 06 Sep 2012 14:59:54 +0400
changeset 13770 c50a78763e19
parent 13656 776ac504ea9b
child 13771 77ca6d7c53d2
7175183: [macosx] Objective-C exception thrown when switching monitor configuration Reviewed-by: prr, serb
jdk/src/share/classes/sun/awt/image/VolatileSurfaceManager.java
--- a/jdk/src/share/classes/sun/awt/image/VolatileSurfaceManager.java	Wed Sep 05 17:33:52 2012 -0700
+++ b/jdk/src/share/classes/sun/awt/image/VolatileSurfaceManager.java	Thu Sep 06 14:59:54 2012 +0400
@@ -333,11 +333,12 @@
             // using a SurfaceData that was created in a different
             // display mode.
             sdBackup = null;
-            sdCurrent = getBackupSurface();
             // Now, invalidate the old hardware-based SurfaceData
+            // Note that getBackupSurface may set sdAccel to null so we have to invalidate it before
             SurfaceData oldData = sdAccel;
             sdAccel = null;
             oldData.invalidate();
+            sdCurrent = getBackupSurface();
         }
         // Update graphicsConfig for the vImg in case it changed due to
         // this display change event