提交 f3bbbdca 编写于 作者: D dcherepanov

6880694: GraphicsDevice.setFullScreenWindow(null) throws NPE if there's a...

6880694: GraphicsDevice.setFullScreenWindow(null) throws NPE if there's a fullscreen window displayed
Summary: handle "empty" refresh rates
Reviewed-by: art, anthony
上级 1f27c5f3
......@@ -1654,6 +1654,7 @@ Java_sun_awt_X11GraphicsEnvironment_getXineramaCenterPoint(JNIEnv *env,
#ifndef HEADLESS
#define BIT_DEPTH_MULTI java_awt_DisplayMode_BIT_DEPTH_MULTI
#define REFRESH_RATE_UNKNOWN java_awt_DisplayMode_REFRESH_RATE_UNKNOWN
typedef Status
(*XRRQueryVersionType) (Display *dpy, int *major_versionp, int *minor_versionp);
......@@ -1765,6 +1766,7 @@ X11GD_CreateDisplayMode(JNIEnv *env, jint width, jint height,
{
jclass displayModeClass;
jmethodID cid;
jint validRefreshRate = refreshRate;
displayModeClass = (*env)->FindClass(env, "java/awt/DisplayMode");
if (JNU_IsNull(env, displayModeClass)) {
......@@ -1780,8 +1782,13 @@ X11GD_CreateDisplayMode(JNIEnv *env, jint width, jint height,
return NULL;
}
// early versions of xrandr may report "empty" rates (6880694)
if (validRefreshRate <= 0) {
validRefreshRate = REFRESH_RATE_UNKNOWN;
}
return (*env)->NewObject(env, displayModeClass, cid,
width, height, bitDepth, refreshRate);
width, height, bitDepth, validRefreshRate);
}
static void
......@@ -1926,8 +1933,7 @@ Java_sun_awt_X11GraphicsDevice_getCurrentDisplayMode
curRate = awt_XRRConfigCurrentRate(config);
if ((sizes != NULL) &&
(curSizeIndex < nsizes) &&
(curRate > 0))
(curSizeIndex < nsizes))
{
XRRScreenSize curSize = sizes[curSizeIndex];
displayMode = X11GD_CreateDisplayMode(env,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册