comparison src/macosx/native/sun/awt/AWTView.m @ 9588:d0dbd097b6aa

8034037: [parfait] JNI exception pending in macosx/native/sun/awt/AWTEvent.m, AWTView.m Reviewed-by: pchelko, azvegint
author serb
date Thu, 06 Mar 2014 15:05:41 +0400
parents 857b83fb0a25
children dd81f57256b8
comparison
equal deleted inserted replaced
22:40b7c0739b97 23:584d84471cf3
1079 static JNF_MEMBER_CACHE(jm_markedRange, jc_CInputMethod, "markedRange", "()[I"); 1079 static JNF_MEMBER_CACHE(jm_markedRange, jc_CInputMethod, "markedRange", "()[I");
1080 JNIEnv *env = [ThreadUtilities getJNIEnv]; 1080 JNIEnv *env = [ThreadUtilities getJNIEnv];
1081 jarray array; 1081 jarray array;
1082 jboolean isCopy; 1082 jboolean isCopy;
1083 jint *_array; 1083 jint *_array;
1084 NSRange range; 1084 NSRange range = NSMakeRange(NSNotFound, 0);
1085 1085
1086 array = JNFCallObjectMethod(env, fInputMethodLOCKABLE, jm_markedRange); // AWT_THREADING Safe (AWTRunLoopMode) 1086 array = JNFCallObjectMethod(env, fInputMethodLOCKABLE, jm_markedRange); // AWT_THREADING Safe (AWTRunLoopMode)
1087 1087
1088 if (array) { 1088 if (array) {
1089 _array = (*env)->GetIntArrayElements(env, array, &isCopy); 1089 _array = (*env)->GetIntArrayElements(env, array, &isCopy);
1090 range = NSMakeRange(_array[0], _array[1]); 1090 if (_array != NULL) {
1091 1091 range.location = _array[0];
1092 #ifdef IM_DEBUG 1092 range.length = _array[1];
1093 fprintf(stderr, "markedRange returning (%lu, %lu)\n", (unsigned long)range.location, (unsigned long)range.length); 1093 #ifdef IM_DEBUG
1094 #endif // IM_DEBUG 1094 fprintf(stderr, "markedRange returning (%lu, %lu)\n",
1095 (*env)->ReleaseIntArrayElements(env, array, _array, 0); 1095 (unsigned long)range.location, (unsigned long)range.length);
1096 #endif // IM_DEBUG
1097 (*env)->ReleaseIntArrayElements(env, array, _array, 0);
1098 }
1096 (*env)->DeleteLocalRef(env, array); 1099 (*env)->DeleteLocalRef(env, array);
1097 } else {
1098 range = NSMakeRange(NSNotFound, 0);
1099 } 1100 }
1100 1101
1101 return range; 1102 return range;
1102 } 1103 }
1103 1104
1113 static JNF_MEMBER_CACHE(jm_selectedRange, jc_CInputMethod, "selectedRange", "()[I"); 1114 static JNF_MEMBER_CACHE(jm_selectedRange, jc_CInputMethod, "selectedRange", "()[I");
1114 JNIEnv *env = [ThreadUtilities getJNIEnv]; 1115 JNIEnv *env = [ThreadUtilities getJNIEnv];
1115 jarray array; 1116 jarray array;
1116 jboolean isCopy; 1117 jboolean isCopy;
1117 jint *_array; 1118 jint *_array;
1118 NSRange range; 1119 NSRange range = NSMakeRange(NSNotFound, 0);
1119 1120
1120 #ifdef IM_DEBUG 1121 #ifdef IM_DEBUG
1121 fprintf(stderr, "AWTView InputMethod Selector Called : [selectedRange]\n"); 1122 fprintf(stderr, "AWTView InputMethod Selector Called : [selectedRange]\n");
1122 #endif // IM_DEBUG 1123 #endif // IM_DEBUG
1123 1124
1124 array = JNFCallObjectMethod(env, fInputMethodLOCKABLE, jm_selectedRange); // AWT_THREADING Safe (AWTRunLoopMode) 1125 array = JNFCallObjectMethod(env, fInputMethodLOCKABLE, jm_selectedRange); // AWT_THREADING Safe (AWTRunLoopMode)
1125 if (array) { 1126 if (array) {
1126 _array = (*env)->GetIntArrayElements(env, array, &isCopy); 1127 _array = (*env)->GetIntArrayElements(env, array, &isCopy);
1127 range = NSMakeRange(_array[0], _array[1]); 1128 if (_array != NULL) {
1128 (*env)->ReleaseIntArrayElements(env, array, _array, 0); 1129 range.location = _array[0];
1130 range.length = _array[1];
1131 (*env)->ReleaseIntArrayElements(env, array, _array, 0);
1132 }
1129 (*env)->DeleteLocalRef(env, array); 1133 (*env)->DeleteLocalRef(env, array);
1130 } else {
1131 range = NSMakeRange(NSNotFound, 0);
1132 } 1134 }
1133 1135
1134 return range; 1136 return range;
1135
1136 } 1137 }
1137 1138
1138 /* This method returns the first frame of rects for theRange in screen coordindate system. 1139 /* This method returns the first frame of rects for theRange in screen coordindate system.
1139 */ 1140 */
1140 - (NSRect) firstRectForCharacterRange:(NSRange)theRange actualRange:(NSRangePointer)actualRange 1141 - (NSRect) firstRectForCharacterRange:(NSRange)theRange actualRange:(NSRangePointer)actualRange
1141 { 1142 {
1142 if (!fInputMethodLOCKABLE) { 1143 if (!fInputMethodLOCKABLE) {
1143 return NSMakeRect(0, 0, 0, 0); 1144 return NSZeroRect;
1144 } 1145 }
1145 1146
1146 static JNF_MEMBER_CACHE(jm_firstRectForCharacterRange, jc_CInputMethod, 1147 static JNF_MEMBER_CACHE(jm_firstRectForCharacterRange, jc_CInputMethod,
1147 "firstRectForCharacterRange", "(I)[I"); 1148 "firstRectForCharacterRange", "(I)[I");
1148 JNIEnv *env = [ThreadUtilities getJNIEnv]; 1149 JNIEnv *env = [ThreadUtilities getJNIEnv];
1150 jboolean isCopy; 1151 jboolean isCopy;
1151 jint *_array; 1152 jint *_array;
1152 NSRect rect; 1153 NSRect rect;
1153 1154
1154 #ifdef IM_DEBUG 1155 #ifdef IM_DEBUG
1155 fprintf(stderr, "AWTView InputMethod Selector Called : [firstRectForCharacterRange:] location=%lu, length=%lu\n", (unsigned long)theRange.location, (unsigned long)theRange.length); 1156 fprintf(stderr,
1156 #endif // IM_DEBUG 1157 "AWTView InputMethod Selector Called : [firstRectForCharacterRange:] location=%lu, length=%lu\n",
1157 1158 (unsigned long)theRange.location, (unsigned long)theRange.length);
1158 array = JNFCallObjectMethod(env, fInputMethodLOCKABLE, jm_firstRectForCharacterRange, theRange.location); // AWT_THREADING Safe (AWTRunLoopMode) 1159 #endif // IM_DEBUG
1160
1161 array = JNFCallObjectMethod(env, fInputMethodLOCKABLE, jm_firstRectForCharacterRange,
1162 theRange.location); // AWT_THREADING Safe (AWTRunLoopMode)
1159 1163
1160 _array = (*env)->GetIntArrayElements(env, array, &isCopy); 1164 _array = (*env)->GetIntArrayElements(env, array, &isCopy);
1161 rect = ConvertNSScreenRect(env, NSMakeRect(_array[0], _array[1], _array[2], _array[3])); 1165 if (_array) {
1162 (*env)->ReleaseIntArrayElements(env, array, _array, 0); 1166 rect = ConvertNSScreenRect(env, NSMakeRect(_array[0], _array[1], _array[2], _array[3]));
1167 (*env)->ReleaseIntArrayElements(env, array, _array, 0);
1168 } else {
1169 rect = NSZeroRect;
1170 }
1163 (*env)->DeleteLocalRef(env, array); 1171 (*env)->DeleteLocalRef(env, array);
1164 1172
1165 #ifdef IM_DEBUG 1173 #ifdef IM_DEBUG
1166 fprintf(stderr, "firstRectForCharacterRange returning x=%f, y=%f, width=%f, height=%f\n", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); 1174 fprintf(stderr,
1175 "firstRectForCharacterRange returning x=%f, y=%f, width=%f, height=%f\n",
1176 rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
1167 #endif // IM_DEBUG 1177 #endif // IM_DEBUG
1168 return rect; 1178 return rect;
1169 } 1179 }
1170 1180
1171 /* This method returns the index for character that is nearest to thePoint. thPoint is in 1181 /* This method returns the index for character that is nearest to thePoint. thPoint is in