8008803: [macosx] JVM crash in apple.laf.JRSUIUtils.HitDetection.getHitForPoint
Reviewed-by: prr, azvegint
--- a/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIControl.java Tue Jun 09 18:57:54 2015 +0300
+++ b/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIControl.java Wed Jun 10 17:18:10 2015 +0300
@@ -275,7 +275,7 @@
}
- Hit getHitForPoint(final double x, final double y, final double w, final double h, final double hitX, final double hitY) {
+ Hit getHitForPoint(final int x, final int y, final int w, final int h, final int hitX, final int hitY) {
sync();
// reflect hitY about the midline of the control before sending to native
final Hit hit = JRSUIConstants.getHit(getNativeHitPart(cfDictionaryPtr, priorEncodedProperties, currentEncodedProperties, x, y, w, h, hitX, 2 * y + h - hitY));
@@ -283,7 +283,7 @@
return hit;
}
- void getPartBounds(final double[] rect, final double x, final double y, final double w, final double h, final int part) {
+ void getPartBounds(final double[] rect, final int x, final int y, final int w, final int h, final int part) {
if (rect == null) throw new NullPointerException("Cannot load null rect");
if (rect.length != 4) throw new IllegalArgumentException("Rect must have four elements");
@@ -292,7 +292,7 @@
priorEncodedProperties = currentEncodedProperties;
}
- double getScrollBarOffsetChange(final double x, final double y, final double w, final double h, final int offset, final int visibleAmount, final int extent) {
+ double getScrollBarOffsetChange(final int x, final int y, final int w, final int h, final int offset, final int visibleAmount, final int extent) {
sync();
final double offsetChange = getNativeScrollBarOffsetChange(cfDictionaryPtr, priorEncodedProperties, currentEncodedProperties, x, y, w, h, offset, visibleAmount, extent);
priorEncodedProperties = currentEncodedProperties;
--- a/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIUtils.java Tue Jun 09 18:57:54 2015 +0300
+++ b/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIUtils.java Wed Jun 10 17:18:10 2015 +0300
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,14 +25,15 @@
package apple.laf;
-import com.apple.laf.AquaImageFactory.NineSliceMetrics;
+import java.security.AccessController;
-import apple.laf.JRSUIConstants.*;
+import apple.laf.JRSUIConstants.Hit;
+import apple.laf.JRSUIConstants.ScrollBarPart;
+import com.apple.laf.AquaImageFactory.NineSliceMetrics;
import sun.security.action.GetPropertyAction;
-import java.security.AccessController;
+public final class JRSUIUtils {
-public class JRSUIUtils {
static boolean isLeopard = isMacOSXLeopard();
static boolean isSnowLeopardOrBelow = isMacOSXSnowLeopardOrBelow();
@@ -48,7 +49,9 @@
return currentMacOSXVersionMatchesGivenVersionRange(version, true, false, false);
}
- static boolean currentMacOSXVersionMatchesGivenVersionRange(final int version, final boolean inclusive, final boolean matchBelow, final boolean matchAbove) {
+ static boolean currentMacOSXVersionMatchesGivenVersionRange(
+ final int version, final boolean inclusive,
+ final boolean matchBelow, final boolean matchAbove) {
// split the "10.x.y" version number
String osVersion = AccessController.doPrivileged(new GetPropertyAction("os.version"));
String[] fragments = osVersion.split("\\.");
@@ -99,12 +102,22 @@
return shouldUseScrollToClick();
}
- public static void getPartBounds(final double[] rect, final JRSUIControl control, final double x, final double y, final double w, final double h, final ScrollBarPart part) {
+ public static void getPartBounds(final double[] rect,
+ final JRSUIControl control,
+ final int x, final int y, final int w,
+ final int h,
+ final ScrollBarPart part) {
control.getPartBounds(rect, x, y, w, h, part.ordinal);
}
- public static double getNativeOffsetChange(final JRSUIControl control, final double x, final double y, final double w, final double h, final int offset, final int visibleAmount, final int extent) {
- return control.getScrollBarOffsetChange(x, y, w, h, offset, visibleAmount, extent);
+ public static double getNativeOffsetChange(final JRSUIControl control,
+ final int x, final int y,
+ final int w, final int h,
+ final int offset,
+ final int visibleAmount,
+ final int extent) {
+ return control.getScrollBarOffsetChange(x, y, w, h, offset,
+ visibleAmount, extent);
}
}
@@ -115,7 +128,10 @@
}
public static class HitDetection {
- public static Hit getHitForPoint(final JRSUIControl control, final double x, final double y, final double w, final double h, final double hitX, final double hitY) {
+ public static Hit getHitForPoint(final JRSUIControl control,
+ final int x, final int y, final int w,
+ final int h, final int hitX,
+ final int hitY) {
return control.getHitForPoint(x, y, w, h, hitX, hitY);
}
}