mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-23 20:44:41 +02:00
7175566: [macosx] Glich in fix for CR7124247 caused MacOS crash during PIT testing
Reviewed-by: anthony, dcherepanov
This commit is contained in:
parent
92246eda42
commit
aaafa0557d
1 changed files with 13 additions and 9 deletions
|
@ -92,8 +92,8 @@ static jobject createJavaDisplayMode(CGDisplayModeRef mode, JNIEnv *env, jint di
|
||||||
CFStringRef currentBPP = CGDisplayModeCopyPixelEncoding(mode);
|
CFStringRef currentBPP = CGDisplayModeCopyPixelEncoding(mode);
|
||||||
bpp = getBPPFromModeString(currentBPP);
|
bpp = getBPPFromModeString(currentBPP);
|
||||||
refrate = CGDisplayModeGetRefreshRate(mode);
|
refrate = CGDisplayModeGetRefreshRate(mode);
|
||||||
h = CGDisplayPixelsHigh(displayID);
|
h = CGDisplayModeGetHeight(mode);
|
||||||
w = CGDisplayPixelsWide(displayID);
|
w = CGDisplayModeGetWidth(mode);
|
||||||
CFRelease(currentBPP);
|
CFRelease(currentBPP);
|
||||||
static JNF_CLASS_CACHE(jc_DisplayMode, "java/awt/DisplayMode");
|
static JNF_CLASS_CACHE(jc_DisplayMode, "java/awt/DisplayMode");
|
||||||
static JNF_CTOR_CACHE(jc_DisplayMode_ctor, jc_DisplayMode, "(IIII)V");
|
static JNF_CTOR_CACHE(jc_DisplayMode_ctor, jc_DisplayMode, "(IIII)V");
|
||||||
|
@ -154,13 +154,17 @@ Java_sun_awt_CGraphicsDevice_nativeSetDisplayMode
|
||||||
CFArrayRef allModes = CGDisplayCopyAllDisplayModes(displayID, NULL);
|
CFArrayRef allModes = CGDisplayCopyAllDisplayModes(displayID, NULL);
|
||||||
CGDisplayModeRef closestMatch = getBestModeForParameters(allModes, (int)w, (int)h, (int)bpp, (int)refrate);
|
CGDisplayModeRef closestMatch = getBestModeForParameters(allModes, (int)w, (int)h, (int)bpp, (int)refrate);
|
||||||
if (closestMatch != NULL) {
|
if (closestMatch != NULL) {
|
||||||
CGDisplayConfigRef config;
|
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
|
||||||
CGError retCode = CGBeginDisplayConfiguration(&config);
|
CGDisplayConfigRef config;
|
||||||
if (retCode == kCGErrorSuccess) {
|
CGError retCode = CGBeginDisplayConfiguration(&config);
|
||||||
CGConfigureDisplayWithDisplayMode(config, displayID, closestMatch, NULL);
|
if (retCode == kCGErrorSuccess) {
|
||||||
CGCompleteDisplayConfiguration(config, kCGConfigureForAppOnly);
|
CGConfigureDisplayWithDisplayMode(config, displayID, closestMatch, NULL);
|
||||||
CFRelease(config);
|
CGCompleteDisplayConfiguration(config, kCGConfigureForAppOnly);
|
||||||
}
|
if (config != NULL) {
|
||||||
|
CFRelease(config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
CFRelease(allModes);
|
CFRelease(allModes);
|
||||||
JNF_COCOA_EXIT(env);
|
JNF_COCOA_EXIT(env);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue