diff options
author | serb <none@none> | 2013-11-22 17:02:49 +0400 |
---|---|---|
committer | serb <none@none> | 2013-11-22 17:02:49 +0400 |
commit | 4e63cf832bf46acee019e3f4cc0fa6c9c47a5ad2 (patch) | |
tree | 012b15c1cff639b49851d56db66d45a013522c9e /src | |
parent | 8ea120d210ca1027b4ea31e44234376273a55032 (diff) |
8028512: [macosx] Crash in full screen api if incorrect display mode is used
Reviewed-by: anthony, leonidr
Diffstat (limited to 'src')
-rw-r--r-- | src/macosx/classes/sun/awt/CGraphicsDevice.java | 14 | ||||
-rw-r--r-- | src/macosx/native/sun/awt/AWTWindow.m | 8 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/macosx/classes/sun/awt/CGraphicsDevice.java b/src/macosx/classes/sun/awt/CGraphicsDevice.java index a3dc7e4cd..22795f3c0 100644 --- a/src/macosx/classes/sun/awt/CGraphicsDevice.java +++ b/src/macosx/classes/sun/awt/CGraphicsDevice.java @@ -158,12 +158,12 @@ public final class CGraphicsDevice extends GraphicsDevice boolean fsSupported = isFullScreenSupported(); if (fsSupported && old != null) { - // restore original display mode and enter windowed mode. + // enter windowed mode and restore original display mode + exitFullScreenExclusive(old); if (originalMode != null) { setDisplayMode(originalMode); originalMode = null; } - exitFullScreenExclusive(old); } super.setFullScreenWindow(w); @@ -227,14 +227,10 @@ public final class CGraphicsDevice extends GraphicsDevice throw new IllegalArgumentException("Invalid display mode"); } if (!Objects.equals(dm, getDisplayMode())) { - final Window w = getFullScreenWindow(); - if (w != null) { - exitFullScreenExclusive(w); - } nativeSetDisplayMode(displayID, dm.getWidth(), dm.getHeight(), - dm.getBitDepth(), dm.getRefreshRate()); - if (isFullScreenSupported() && w != null) { - enterFullScreenExclusive(w); + dm.getBitDepth(), dm.getRefreshRate()); + if (isFullScreenSupported() && getFullScreenWindow() != null) { + getFullScreenWindow().setSize(dm.getWidth(), dm.getHeight()); } } } diff --git a/src/macosx/native/sun/awt/AWTWindow.m b/src/macosx/native/sun/awt/AWTWindow.m index dcda6c3f9..f9a7919b4 100644 --- a/src/macosx/native/sun/awt/AWTWindow.m +++ b/src/macosx/native/sun/awt/AWTWindow.m @@ -1236,7 +1236,9 @@ JNF_COCOA_ENTER(env); NSRect screenRect = [[nsWindow screen] frame]; [nsWindow setFrame:screenRect display:YES]; } else { - [JNFException raise:env as:kRuntimeException reason:"Failed to enter full screen."]; + [JNFException raise:[ThreadUtilities getJNIEnv] + as:kRuntimeException + reason:"Failed to enter full screen."]; } }]; @@ -1261,7 +1263,9 @@ JNF_COCOA_ENTER(env); // GraphicsDevice takes care of restoring pre full screen bounds } else { - [JNFException raise:env as:kRuntimeException reason:"Failed to exit full screen."]; + [JNFException raise:[ThreadUtilities getJNIEnv] + as:kRuntimeException + reason:"Failed to exit full screen."]; } }]; |