Add null checks on all JNI object parameters.

--- java/lib/NetworkTablesJNI.cpp
+++ java/lib/NetworkTablesJNI.cpp
@@ -31,6 +31,7 @@
 static JClass keyNotDefinedEx;
 static JClass persistentEx;
 static JClass illegalArgEx;
+static JClass nullPointerEx;
 // Thread-attached environment for listener callbacks.
 static JNIEnv *listenerEnv = nullptr;

@@ -88,6 +89,9 @@
   illegalArgEx = JClass(env, "java/lang/IllegalArgumentException");
   if (!illegalArgEx) return JNI_ERR;

+  nullPointerEx = JClass(env, "java/lang/NullPointerException");
+  if (!nullPointerEx) return JNI_ERR;
+
   // Initial configuration of listener start/exit
   nt::SetListenerOnStart(ListenerOnStart);
   nt::SetListenerOnExit(ListenerOnExit);
@@ -107,6 +111,7 @@
   keyNotDefinedEx.free(env);
   persistentEx.free(env);
   illegalArgEx.free(env);
+  nullPointerEx.free(env);
   jvm = nullptr;
 }

@@ -307,6 +312,10 @@
 JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_containsKey
   (JNIEnv *env, jclass, jstring key)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return false;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val) return false;
   return true;
@@ -320,6 +329,10 @@
 JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getType
   (JNIEnv *env, jclass, jstring key)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return 0;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val) return NT_UNASSIGNED;
   return val->type();
@@ -333,6 +346,10 @@
 JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putBoolean
   (JNIEnv *env, jclass, jstring key, jboolean value)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return false;
+  }
   return nt::SetEntryValue(JStringRef{env, key},
                            nt::Value::MakeBoolean(value != JNI_FALSE));
 }
@@ -345,6 +362,10 @@
 JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putDouble
   (JNIEnv *env, jclass, jstring key, jdouble value)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return false;
+  }
   return nt::SetEntryValue(JStringRef{env, key},
                            nt::Value::MakeDouble(value));
 }
@@ -357,6 +378,14 @@
 JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putString
   (JNIEnv *env, jclass, jstring key, jstring value)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return false;
+  }
+  if (!value) {
+    env->ThrowNew(nullPointerEx, "value cannot be null");
+    return false;
+  }
   return nt::SetEntryValue(JStringRef{env, key},
                            nt::Value::MakeString(JStringRef{env, value}));
 }
@@ -369,6 +398,14 @@
 JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putRaw__Ljava_lang_String_2_3B
   (JNIEnv *env, jclass, jstring key, jbyteArray value)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return false;
+  }
+  if (!value) {
+    env->ThrowNew(nullPointerEx, "value cannot be null");
+    return false;
+  }
   auto v = FromJavaRaw(env, value);
   if (!v) return false;
   return nt::SetEntryValue(JStringRef{env, key}, v);
@@ -382,6 +419,14 @@
 JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putRaw__Ljava_lang_String_2Ljava_nio_ByteBuffer_2I
   (JNIEnv *env, jclass, jstring key, jobject value, jint len)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return false;
+  }
+  if (!value) {
+    env->ThrowNew(nullPointerEx, "value cannot be null");
+    return false;
+  }
   auto v = FromJavaRawBB(env, value, len);
   if (!v) return false;
   return nt::SetEntryValue(JStringRef{env, key}, v);
@@ -395,6 +440,14 @@
 JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putBooleanArray
   (JNIEnv *env, jclass, jstring key, jbooleanArray value)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return false;
+  }
+  if (!value) {
+    env->ThrowNew(nullPointerEx, "value cannot be null");
+    return false;
+  }
   auto v = FromJavaBooleanArray(env, value);
   if (!v) return false;
   return nt::SetEntryValue(JStringRef{env, key}, v);
@@ -408,6 +461,14 @@
 JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putDoubleArray
   (JNIEnv *env, jclass, jstring key, jdoubleArray value)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return false;
+  }
+  if (!value) {
+    env->ThrowNew(nullPointerEx, "value cannot be null");
+    return false;
+  }
   auto v = FromJavaDoubleArray(env, value);
   if (!v) return false;
   return nt::SetEntryValue(JStringRef{env, key}, v);
@@ -421,6 +482,14 @@
 JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putStringArray
   (JNIEnv *env, jclass, jstring key, jobjectArray value)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return false;
+  }
+  if (!value) {
+    env->ThrowNew(nullPointerEx, "value cannot be null");
+    return false;
+  }
   auto v = FromJavaStringArray(env, value);
   if (!v) return false;
   return nt::SetEntryValue(JStringRef{env, key}, v);
@@ -434,6 +503,10 @@
 JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutBoolean
   (JNIEnv *env, jclass, jstring key, jboolean value)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return;
+  }
   nt::SetEntryTypeValue(JStringRef{env, key},
                         nt::Value::MakeBoolean(value != JNI_FALSE));
 }
@@ -446,6 +519,10 @@
 JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutDouble
   (JNIEnv *env, jclass, jstring key, jdouble value)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return;
+  }
   nt::SetEntryTypeValue(JStringRef{env, key}, nt::Value::MakeDouble(value));
 }

@@ -457,6 +534,14 @@
 JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutString
   (JNIEnv *env, jclass, jstring key, jstring value)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return;
+  }
+  if (!value) {
+    env->ThrowNew(nullPointerEx, "value cannot be null");
+    return;
+  }
   nt::SetEntryTypeValue(JStringRef{env, key},
                         nt::Value::MakeString(JStringRef{env, value}));
 }
@@ -469,6 +554,14 @@
 JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutRaw__Ljava_lang_String_2_3B
   (JNIEnv *env, jclass, jstring key, jbyteArray value)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return;
+  }
+  if (!value) {
+    env->ThrowNew(nullPointerEx, "value cannot be null");
+    return;
+  }
   auto v = FromJavaRaw(env, value);
   if (!v) return;
   nt::SetEntryTypeValue(JStringRef{env, key}, v);
@@ -482,6 +575,14 @@
 JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutRaw__Ljava_lang_String_2Ljava_nio_ByteBuffer_2I
   (JNIEnv *env, jclass, jstring key, jobject value, jint len)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return;
+  }
+  if (!value) {
+    env->ThrowNew(nullPointerEx, "value cannot be null");
+    return;
+  }
   auto v = FromJavaRawBB(env, value, len);
   if (!v) return;
   nt::SetEntryTypeValue(JStringRef{env, key}, v);
@@ -495,6 +596,14 @@
 JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutBooleanArray
   (JNIEnv *env, jclass, jstring key, jbooleanArray value)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return;
+  }
+  if (!value) {
+    env->ThrowNew(nullPointerEx, "value cannot be null");
+    return;
+  }
   auto v = FromJavaBooleanArray(env, value);
   if (!v) return;
   nt::SetEntryTypeValue(JStringRef{env, key}, v);
@@ -508,6 +617,14 @@
 JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutDoubleArray
   (JNIEnv *env, jclass, jstring key, jdoubleArray value)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return;
+  }
+  if (!value) {
+    env->ThrowNew(nullPointerEx, "value cannot be null");
+    return;
+  }
   auto v = FromJavaDoubleArray(env, value);
   if (!v) return;
   nt::SetEntryTypeValue(JStringRef{env, key}, v);
@@ -521,6 +638,14 @@
 JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutStringArray
   (JNIEnv *env, jclass, jstring key, jobjectArray value)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return;
+  }
+  if (!value) {
+    env->ThrowNew(nullPointerEx, "value cannot be null");
+    return;
+  }
   auto v = FromJavaStringArray(env, value);
   if (!v) return;
   nt::SetEntryTypeValue(JStringRef{env, key}, v);
@@ -534,6 +659,10 @@
 JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getValue__Ljava_lang_String_2
   (JNIEnv *env, jclass, jstring key)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return nullptr;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val) {
     ThrowTableKeyNotDefined(env, key);
@@ -550,6 +679,10 @@
 JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getBoolean__Ljava_lang_String_2
   (JNIEnv *env, jclass, jstring key)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return false;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val || !val->IsBoolean()) {
     ThrowTableKeyNotDefined(env, key);
@@ -566,6 +699,10 @@
 JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getDouble__Ljava_lang_String_2
   (JNIEnv *env, jclass, jstring key)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return 0;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val || !val->IsDouble()) {
     ThrowTableKeyNotDefined(env, key);
@@ -582,6 +719,10 @@
 JNIEXPORT jstring JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getString__Ljava_lang_String_2
   (JNIEnv *env, jclass, jstring key)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return nullptr;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val || !val->IsString()) {
     ThrowTableKeyNotDefined(env, key);
@@ -598,6 +739,10 @@
 JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getRaw__Ljava_lang_String_2
   (JNIEnv *env, jclass, jstring key)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return nullptr;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val || !val->IsRaw()) {
     ThrowTableKeyNotDefined(env, key);
@@ -614,6 +759,10 @@
 JNIEXPORT jbooleanArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getBooleanArray__Ljava_lang_String_2
   (JNIEnv *env, jclass, jstring key)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return nullptr;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val || !val->IsBooleanArray()) {
     ThrowTableKeyNotDefined(env, key);
@@ -630,6 +779,10 @@
 JNIEXPORT jdoubleArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getDoubleArray__Ljava_lang_String_2
   (JNIEnv *env, jclass, jstring key)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return nullptr;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val || !val->IsDoubleArray()) {
     ThrowTableKeyNotDefined(env, key);
@@ -646,6 +799,10 @@
 JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getStringArray__Ljava_lang_String_2
   (JNIEnv *env, jclass, jstring key)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return nullptr;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val || !val->IsStringArray()) {
     ThrowTableKeyNotDefined(env, key);
@@ -662,6 +819,10 @@
 JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getValue__Ljava_lang_String_2Ljava_lang_Object_2
   (JNIEnv *env, jclass, jstring key, jobject defaultValue)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return nullptr;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val) return defaultValue;
   return MakeJObject(env, *val);
@@ -675,6 +836,10 @@
 JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getBoolean__Ljava_lang_String_2Z
   (JNIEnv *env, jclass, jstring key, jboolean defaultValue)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return false;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val || !val->IsBoolean()) return defaultValue;
   return val->GetBoolean();
@@ -688,6 +853,10 @@
 JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getDouble__Ljava_lang_String_2D
   (JNIEnv *env, jclass, jstring key, jdouble defaultValue)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return 0;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val || !val->IsDouble()) return defaultValue;
   return val->GetDouble();
@@ -701,6 +870,10 @@
 JNIEXPORT jstring JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getString__Ljava_lang_String_2Ljava_lang_String_2
   (JNIEnv *env, jclass, jstring key, jstring defaultValue)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return nullptr;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val || !val->IsString()) return defaultValue;
   return MakeJString(env, val->GetString());
@@ -714,6 +887,10 @@
 JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getRaw__Ljava_lang_String_2_3B
   (JNIEnv *env, jclass, jstring key, jbyteArray defaultValue)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return nullptr;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val || !val->IsRaw()) return defaultValue;
   return MakeJByteArray(env, val->GetRaw());
@@ -727,6 +904,10 @@
 JNIEXPORT jbooleanArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getBooleanArray__Ljava_lang_String_2_3Z
   (JNIEnv *env, jclass, jstring key, jbooleanArray defaultValue)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return nullptr;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val || !val->IsBooleanArray()) return defaultValue;
   return MakeJBooleanArray(env, val->GetBooleanArray());
@@ -740,6 +921,10 @@
 JNIEXPORT jdoubleArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getDoubleArray__Ljava_lang_String_2_3D
   (JNIEnv *env, jclass, jstring key, jdoubleArray defaultValue)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return nullptr;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val || !val->IsDoubleArray()) return defaultValue;
   return MakeJDoubleArray(env, val->GetDoubleArray());
@@ -753,6 +938,10 @@
 JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getStringArray__Ljava_lang_String_2_3Ljava_lang_String_2
   (JNIEnv *env, jclass, jstring key, jobjectArray defaultValue)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return nullptr;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val || !val->IsStringArray()) return defaultValue;
   return MakeJStringArray(env, val->GetStringArray());
@@ -766,6 +955,10 @@
 JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultBoolean
   (JNIEnv *env, jclass, jstring key, jboolean defaultValue)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return false;
+  }
   return nt::SetDefaultEntryValue(JStringRef{env, key},
                                   nt::Value::MakeBoolean(defaultValue != JNI_FALSE));
 }
@@ -778,6 +971,10 @@
 JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultDouble
   (JNIEnv *env, jclass, jstring key, jdouble defaultValue)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return 0;
+  }
   return nt::SetDefaultEntryValue(JStringRef{env, key},
                                   nt::Value::MakeDouble(defaultValue));
 }
@@ -790,6 +987,14 @@
 JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultString
   (JNIEnv *env, jclass, jstring key, jstring defaultValue)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return false;
+  }
+  if (!defaultValue) {
+    env->ThrowNew(nullPointerEx, "defaultValue cannot be null");
+    return false;
+  }
   return nt::SetDefaultEntryValue(
       JStringRef{env, key},
       nt::Value::MakeString(JStringRef{env, defaultValue}));
@@ -803,6 +1008,14 @@
 JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultRaw
   (JNIEnv *env, jclass, jstring key, jbyteArray defaultValue)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return false;
+  }
+  if (!defaultValue) {
+    env->ThrowNew(nullPointerEx, "defaultValue cannot be null");
+    return false;
+  }
   auto v = FromJavaRaw(env, defaultValue);
   return nt::SetDefaultEntryValue(JStringRef{env, key}, v);
 }
@@ -815,6 +1028,14 @@
 JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultBooleanArray
   (JNIEnv *env, jclass, jstring key, jbooleanArray defaultValue)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return false;
+  }
+  if (!defaultValue) {
+    env->ThrowNew(nullPointerEx, "defaultValue cannot be null");
+    return false;
+  }
   auto v = FromJavaBooleanArray(env, defaultValue);
   return nt::SetDefaultEntryValue(JStringRef{env, key}, v);
 }
@@ -827,6 +1048,14 @@
 JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultDoubleArray
   (JNIEnv *env, jclass, jstring key, jdoubleArray defaultValue)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return false;
+  }
+  if (!defaultValue) {
+    env->ThrowNew(nullPointerEx, "defaultValue cannot be null");
+    return false;
+  }
   auto v = FromJavaDoubleArray(env, defaultValue);
   return nt::SetDefaultEntryValue(JStringRef{env, key}, v);
 }
@@ -839,6 +1068,14 @@
 JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setDefaultStringArray
   (JNIEnv *env, jclass, jstring key, jobjectArray defaultValue)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return false;
+  }
+  if (!defaultValue) {
+    env->ThrowNew(nullPointerEx, "defaultValue cannot be null");
+    return false;
+  }
   auto v = FromJavaStringArray(env, defaultValue);
   return nt::SetDefaultEntryValue(JStringRef{env, key}, v);
 }
@@ -851,6 +1088,10 @@
 JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setEntryFlags
   (JNIEnv *env, jclass, jstring key, jint flags)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return;
+  }
   nt::SetEntryFlags(JStringRef{env, key}, flags);
 }

@@ -862,6 +1103,10 @@
 JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getEntryFlags
   (JNIEnv *env, jclass, jstring key)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return 0;
+  }
   return nt::GetEntryFlags(JStringRef{env, key});
 }

@@ -873,6 +1118,10 @@
 JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_deleteEntry
   (JNIEnv *env, jclass, jstring key)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return;
+  }
   nt::DeleteEntry(JStringRef{env, key});
 }

@@ -895,6 +1144,10 @@
 JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getEntries
   (JNIEnv *env, jclass, jstring prefix, jint types)
 {
+  if (!prefix) {
+    env->ThrowNew(nullPointerEx, "prefix cannot be null");
+    return nullptr;
+  }
   auto arr = nt::GetEntryInfo(JStringRef{env, prefix}, types);
   jobjectArray jarr = env->NewObjectArray(arr.size(), entryInfoCls, nullptr);
   if (!jarr) return nullptr;
@@ -924,6 +1177,15 @@
 JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_addEntryListener
   (JNIEnv *envouter, jclass, jstring prefix, jobject listener, jint flags)
 {
+  if (!prefix) {
+    envouter->ThrowNew(nullPointerEx, "prefix cannot be null");
+    return 0;
+  }
+  if (!listener) {
+    envouter->ThrowNew(nullPointerEx, "listener cannot be null");
+    return 0;
+  }
+
   // the shared pointer to the weak global will keep it around until the
   // entry listener is destroyed
   auto listener_global =
@@ -987,6 +1249,11 @@
 JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_addConnectionListener
   (JNIEnv *envouter, jclass, jobject listener, jboolean immediateNotify)
 {
+  if (!listener) {
+    envouter->ThrowNew(nullPointerEx, "listener cannot be null");
+    return 0;
+  }
+
   // the shared pointer to the weak global will keep it around until the
   // entry listener is destroyed
   auto listener_global =
@@ -1048,6 +1315,10 @@
 JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getRpc__Ljava_lang_String_2
   (JNIEnv *env, jclass, jstring key)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return nullptr;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val || !val->IsRpc()) {
     ThrowTableKeyNotDefined(env, key);
@@ -1064,6 +1335,14 @@
 JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getRpc__Ljava_lang_String_2_3B
   (JNIEnv *env, jclass, jstring key, jbyteArray defaultValue)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return nullptr;
+  }
+  if (!defaultValue) {
+    env->ThrowNew(nullPointerEx, "defaultValue cannot be null");
+    return nullptr;
+  }
   auto val = nt::GetEntryValue(JStringRef{env, key});
   if (!val || !val->IsRpc()) return defaultValue;
   return MakeJByteArray(env, val->GetRpc());
@@ -1077,6 +1356,14 @@
 JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_callRpc__Ljava_lang_String_2_3B
   (JNIEnv *env, jclass, jstring key, jbyteArray params)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return 0;
+  }
+  if (!params) {
+    env->ThrowNew(nullPointerEx, "params cannot be null");
+    return 0;
+  }
   return nt::CallRpc(JStringRef{env, key}, JByteArrayRef{env, params});
 }

@@ -1088,6 +1375,14 @@
 JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_callRpc__Ljava_lang_String_2Ljava_nio_ByteBuffer_2I
   (JNIEnv *env, jclass, jstring key, jobject params, jint params_len)
 {
+  if (!key) {
+    env->ThrowNew(nullPointerEx, "key cannot be null");
+    return 0;
+  }
+  if (!params) {
+    env->ThrowNew(nullPointerEx, "params cannot be null");
+    return 0;
+  }
   return nt::CallRpc(JStringRef{env, key},
                      JByteArrayRef{env, params, params_len});
 }
@@ -1100,6 +1395,10 @@
 JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setNetworkIdentity
   (JNIEnv *env, jclass, jstring name)
 {
+  if (!name) {
+    env->ThrowNew(nullPointerEx, "name cannot be null");
+    return;
+  }
   nt::SetNetworkIdentity(JStringRef{env, name});
 }

@@ -1112,6 +1411,14 @@
   (JNIEnv *env, jclass, jstring persistFilename, jstring listenAddress,
    jint port)
 {
+  if (!persistFilename) {
+    env->ThrowNew(nullPointerEx, "persistFilename cannot be null");
+    return;
+  }
+  if (!listenAddress) {
+    env->ThrowNew(nullPointerEx, "listenAddress cannot be null");
+    return;
+  }
   nt::StartServer(JStringRef{env, persistFilename},
                   JStringRef{env, listenAddress}.c_str(), port);
 }
@@ -1146,6 +1453,10 @@
 JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_startClient__Ljava_lang_String_2I
   (JNIEnv *env, jclass, jstring serverName, jint port)
 {
+  if (!serverName) {
+    env->ThrowNew(nullPointerEx, "serverName cannot be null");
+    return;
+  }
   nt::StartClient(JStringRef{env, serverName}.c_str(), port);
 }

@@ -1157,6 +1468,14 @@
 JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_startClient___3Ljava_lang_String_2_3I
   (JNIEnv *env, jclass, jobjectArray serverNames, jintArray ports)
 {
+  if (!serverNames) {
+    env->ThrowNew(nullPointerEx, "serverNames cannot be null");
+    return;
+  }
+  if (!ports) {
+    env->ThrowNew(nullPointerEx, "ports cannot be null");
+    return;
+  }
   int len = env->GetArrayLength(serverNames);
   if (len != env->GetArrayLength(ports)) {
     env->ThrowNew(illegalArgEx,
@@ -1174,7 +1493,7 @@
     JLocal<jstring> elem{
         env, static_cast<jstring>(env->GetObjectArrayElement(serverNames, i))};
     if (!elem) {
-      env->ThrowNew(illegalArgEx, "null string in serverNames");
+      env->ThrowNew(nullPointerEx, "null string in serverNames");
       return;
     }
     names.emplace_back(JStringRef{env, elem}.str());
@@ -1204,6 +1523,10 @@
 JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setServer__Ljava_lang_String_2I
   (JNIEnv *env, jclass, jstring serverName, jint port)
 {
+  if (!serverName) {
+    env->ThrowNew(nullPointerEx, "serverName cannot be null");
+    return;
+  }
   nt::SetServer(JStringRef{env, serverName}.c_str(), port);
 }

@@ -1215,6 +1538,14 @@
 JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setServer___3Ljava_lang_String_2_3I
   (JNIEnv *env, jclass, jobjectArray serverNames, jintArray ports)
 {
+  if (!serverNames) {
+    env->ThrowNew(nullPointerEx, "serverNames cannot be null");
+    return;
+  }
+  if (!ports) {
+    env->ThrowNew(nullPointerEx, "ports cannot be null");
+    return;
+  }
   int len = env->GetArrayLength(serverNames);
   if (len != env->GetArrayLength(ports)) {
     env->ThrowNew(illegalArgEx,
@@ -1232,7 +1563,7 @@
     JLocal<jstring> elem{
         env, static_cast<jstring>(env->GetObjectArrayElement(serverNames, i))};
     if (!elem) {
-      env->ThrowNew(illegalArgEx, "null string in serverNames");
+      env->ThrowNew(nullPointerEx, "null string in serverNames");
       return;
     }
     names.emplace_back(JStringRef{env, elem}.str());
@@ -1303,6 +1634,10 @@
 JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_savePersistent
   (JNIEnv *env, jclass, jstring filename)
 {
+  if (!filename) {
+    env->ThrowNew(nullPointerEx, "filename cannot be null");
+    return;
+  }
   const char *err = nt::SavePersistent(JStringRef{env, filename});
   if (err) env->ThrowNew(persistentEx, err);
 }
@@ -1315,6 +1650,10 @@
 JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_loadPersistent
   (JNIEnv *env, jclass, jstring filename)
 {
+  if (!filename) {
+    env->ThrowNew(nullPointerEx, "filename cannot be null");
+    return nullptr;
+  }
   std::vector<std::string> warns;
   const char *err = nt::LoadPersistent(JStringRef{env, filename},
                                        [&](size_t line, const char *msg) {
@@ -1383,6 +1722,11 @@
 JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setLogger
   (JNIEnv *env, jclass, jobject func, jint minLevel)
 {
+  if (!func) {
+    env->ThrowNew(nullPointerEx, "func cannot be null");
+    return;
+  }
+
   // cls is a temporary here; cannot be used within callback functor
 	jclass cls = env->GetObjectClass(func);
   if (!cls) return;


Start fixing MetaWeblog.

Start fixing MetaWeblog.

svn path=/trunk/KDE/kdepimlibs/; revision=694374

--- metaweblog.cpp
+++ metaweblog.cpp
@@ -82,42 +82,45 @@

 void MetaWeblog::fetchPosting( KBlog::BlogPosting *posting )
 {
-//   Q_D(MetaWeblog);
-//   if ( d->mLock.tryLock() ) {
-//     kDebug(5323) << "Fetching Posting with url " << postingId << endl;
-//     QList<QVariant> args( d->defaultArgs( postingId ) );
-//     d->mXmlRpcClient->call(
-//       "metaWeblog.getPost", args,
-//       d, SLOT( slotFetchPosting( const QList<QVariant>&, const QVariant& ) ),
-//       d, SLOT( slotError( int, const QString&, const QVariant& ) ) );
-//     return true;
-//   }
-//   return false;
-}
-
-void MetaWeblog::modifyPosting( KBlog::BlogPosting *posting )
-{
   Q_D(MetaWeblog);
   if ( !posting ) {
     kDebug(5323) << "MetaWeblog::modifyPosting: posting null pointer"
         << endl;
     emit error ( Other, i18n( "Posting is a null pointer." ) );
-  }
-    kDebug(5323) << "Uploading Posting with postId " << posting->postingId()
+    return;
+  }
+  kDebug(5323) << "Fetching Posting with url " << posting->postingId() << endl;
+  QList<QVariant> args( d->defaultArgs( posting->postingId() ) );
+  d->mXmlRpcClient->call(
+    "metaWeblog.getPost", args,
+    this, SLOT( slotFetchPosting( const QList<QVariant>&, const QVariant& ) ),
+    this, SLOT( slotError( int, const QString&, const QVariant& ) ) );
+}
+
+void MetaWeblog::modifyPosting( KBlog::BlogPosting *posting )
+{
+  Q_D(MetaWeblog);
+  if ( !posting ) {
+    kDebug(5323) << "MetaWeblog::modifyPosting: posting null pointer"
         << endl;
-
-    QList<QVariant> args( d->defaultArgs( posting->postingId() ) );
-    QMap<QString, QVariant> map;
-    map["categories"] = posting->categories();
-    map["description"] = posting->content();
-    map["title"] = posting->title();
-    map["lastModified"] = posting->modificationDateTime().toUtc().dateTime();
-    args << map;
-    args << QVariant( posting->isPublished() );
-    d->mXmlRpcClient->call(
-      "metaWeblog.editPost", args,
-      this, SLOT( slotModifyPosting( const QList<QVariant>&, const QVariant& ) ),
-      this, SLOT ( slotError( int, const QString&, const QVariant& ) ) );
+    emit error ( Other, i18n( "Posting is a null pointer." ) );
+    return;
+  }
+  kDebug(5323) << "Uploading Posting with postId " << posting->postingId()
+      << endl;
+
+  QList<QVariant> args( d->defaultArgs( posting->postingId() ) );
+  QMap<QString, QVariant> map;
+  map["categories"] = posting->categories();
+  map["description"] = posting->content();
+  map["title"] = posting->title();
+  map["lastModified"] = posting->modificationDateTime().toUtc().dateTime();
+  args << map;
+  args << QVariant( posting->isPublished() );
+  d->mXmlRpcClient->call(
+    "metaWeblog.editPost", args,
+     this, SLOT( slotModifyPosting( const QList<QVariant>&, const QVariant& ) ),
+     this, SLOT ( slotError( int, const QString&, const QVariant& ) ) );
 }

 void MetaWeblog::createPosting( KBlog::BlogPosting *posting )
@@ -127,48 +130,47 @@
     kDebug(5323) << "MetaWeblog::createPosting: posting null pointer"
         << endl;
     emit error ( Other, i18n( "Posting is a null pointer." ) );
-  }
-    kDebug(5323) << "Creating new Posting with blogId " << blogId() << endl;
-    QList<QVariant> args( d->defaultArgs( blogId() ) );
-    QMap<QString, QVariant> map;
-    map["categories"] = posting->categories();
-    map["description"] = posting->content();
-    map["title"] = posting->title();
-    map["dateCreated"] = posting->creationDateTime().toUtc().dateTime();
-    args << map;
-    args << QVariant( posting->isPublished() );
-    d->mXmlRpcClient->call (
-      "metaWeblog.newPost", args,
-      this, SLOT( slotCreatePosting( const QList<QVariant>&, const QVariant& ) ),
-      this, SLOT ( slotError( int, const QString&, const QVariant& ) ) );
+    return;
+  }
+  kDebug(5323) << "Creating new Posting with blogId " << blogId() << endl;
+  QList<QVariant> args( d->defaultArgs( blogId() ) );
+  QMap<QString, QVariant> map;
+  map["categories"] = posting->categories();
+  map["description"] = posting->content();
+  map["title"] = posting->title();
+  map["dateCreated"] = posting->creationDateTime().toUtc().dateTime();
+  args << map;
+  args << QVariant( posting->isPublished() );
+  d->mXmlRpcClient->call (
+    "metaWeblog.newPost", args,
+    this, SLOT( slotCreatePosting( const QList<QVariant>&, const QVariant& ) ),
+    this, SLOT ( slotError( int, const QString&, const QVariant& ) ) );
 }

 void MetaWeblog::createMedia( KBlog::BlogMedia *media )
 {
-    Q_D(MetaWeblog);
-    kDebug(5323) << "MetaWeblog::createMedia: name="<< media->name() << endl;
-    QList<QVariant> args( d->defaultArgs( blogId() ) );
-    QMap<QString, QVariant> map;
-    QList<QVariant> list;
-    map["name"] = media->name();
-    map["type"] = media->mimetype();
-    map["bits"] = media->data();
-    args << map;
-    d->mXmlRpcClient->call(
-      "metaWeblog.newMediaObject", args,
-      this, SLOT( slotCreateMedia( const QList<QVariant>&, const QVariant& ) ),
-      this, SLOT ( slotError( int, const QString&, const QVariant& ) ) );
+  Q_D(MetaWeblog);
+  kDebug(5323) << "MetaWeblog::createMedia: name="<< media->name() << endl;
+  QList<QVariant> args( d->defaultArgs( blogId() ) );
+  QMap<QString, QVariant> map;
+  QList<QVariant> list;
+  map["name"] = media->name();
+  map["type"] = media->mimetype();
+  map["bits"] = media->data();
+  args << map;
+  d->mXmlRpcClient->call(
+    "metaWeblog.newMediaObject", args,
+    this, SLOT( slotCreateMedia( const QList<QVariant>&, const QVariant& ) ),
+    this, SLOT ( slotError( int, const QString&, const QVariant& ) ) );

 }

 MetaWeblogPrivate::MetaWeblogPrivate()
 {
-  mXmlRpcClient = 0;
 }

 MetaWeblogPrivate::~MetaWeblogPrivate()
 {
-  delete mXmlRpcClient;
 }

 QList<QVariant> MetaWeblogPrivate::defaultArgs( const QString &id )
@@ -293,9 +295,9 @@
   kDebug(5323) << "TOP: " << result[0].typeName() << endl;
   if ( result[0].type() != QVariant::Map ) {
     kDebug(5323) << "Could not fetch posting out of the result from the server." << endl;
-    //emit q->error( KBlog::Blog::ParsingError,
-    //                    i18n( "Could not fetch posting out of the "
-    //                          "result from the server." ) );
+    emit q->error( MetaWeblog::ParsingError,
+                       i18n( "Could not fetch posting out of the "
+                             "result from the server." ) );
   } else {
 //     const QList<QVariant> postReceived = result[0].toList();
 //     QList<QVariant>::ConstIterator it = postReceived.begin();
@@ -307,8 +309,8 @@
 //       emit q->fetchedPosting( posting ); // KUrl( posting.posingtId() ) );
     } else {
       kDebug(5323) << "d->readPostingFromMap failed! " << endl;
-      //emit q->error( KBlog::Blog::ParsingError,
-      //                    i18n( "Could not read posting." ) );
+      emit q->error( MetaWeblog::ParsingError,
+                         i18n( "Could not read posting." ) );
     }
   }
 }
@@ -325,8 +327,8 @@
   kDebug(5323) << "TOP: " << result[0].typeName() << endl;
   if ( result[0].type() != QVariant::String ) {
     kDebug(5323) << "Could not read the postingId, not a string." << endl;
-    //emit q->error( KBlog::Blog::ParsingError,
-    //                    i18n( "Could not read the postingId, not a string." ) );
+    emit q->error( MetaWeblog::ParsingError,
+                       i18n( "Could not read the postingId, not a string." ) );
   } else {
 //     emit q->createdPosting( result[0].toString() );
     kDebug(5323) << "emitting createdPosting( " << result[0].toString() << " )" << endl;
@@ -345,8 +347,8 @@
   kDebug(5323) << "TOP: " << result[0].typeName() << endl;
   if ( result[0].type() != QVariant::Bool ) {
     kDebug(5323) << "Could not read the result, not a boolean." << endl;
-    //emit q->error( KBlog::Blog::ParsingError,
-    //                    i18n( "Could not read the result, not a boolean." ) );
+    emit q->error( MetaWeblog::ParsingError,
+                       i18n( "Could not read the result, not a boolean." ) );
   } else {
 //     emit q->modifiedPosting( result[0].toBool() );
     kDebug(5323) << "emitting modifiedPosting( " << result[0].toBool() << " )" << endl;
@@ -362,8 +364,8 @@
   kDebug(5323) << "TOP: " << result[0].typeName() << endl;
   if ( result[0].type() != 8 ) {
     kDebug(5323) << "Could not read the result, not a map." << endl;
-    //emit q->error( KBlog::Blog::ParsingError,
-    //                    i18n( "Could not read the result, not a map." ) );
+    emit q->error( MetaWeblog::ParsingError,
+                       i18n( "Could not read the result, not a map." ) );
   } else {
     const QMap<QString, QVariant> resultStruct = result[0].toMap();
     const QString url = resultStruct["url"].toString();
@@ -380,10 +382,11 @@
                                                      const QString &errorString,
                                                      const QVariant &id )
 {
+  Q_Q(MetaWeblog);
   Q_UNUSED( number );
   Q_UNUSED( id );

-  //emit q->error( KBlog::Blog::XmlRpc, errorString );
+  emit q->error( MetaWeblog::XmlRpc, errorString );
 }

 bool MetaWeblogPrivate::readPostingFromMap( BlogPosting *post,


Bug [#1511]. Ensure representation set up initially.

--- src/Editor.cxx
+++ src/Editor.cxx
@@ -232,6 +232,8 @@

 	llc.SetLevel(LineLayoutCache::llcCaret);
 	posCache.SetSize(0x400);
+
+	SetRepresentations();
 }

 Editor::~Editor() {


Fixed problem with reported and actual throttle after trim failure

--- FGTrimLong.cpp
+++ FGTrimLong.cpp
@@ -406,7 +406,9 @@
         if(checkLimits(udotf,dth,0,1) == false) {
           cout << "    Sorry, udot doesn't appear to be trimmable" << endl;
           cout << "    Resetting throttles to zero" << endl;
+          setThrottlesPct(0);
           fdmex->GetFCS()->SetThrottleCmd(-1,0);
+          fdmex->RunIC(fgic);
           total_its=k;
           k=Ncycles; //force the trim to fail
         }


INTEGRATION: CWS sfxcleanup (1.188.34); FILE MERGED 2006/04/28 13:42:53 mba 1.188.34.3: RESYNC: (1.189-1.190); FILE MERGED 2006/03/24 13:23:05 mba 1.188.34.2: RESYNC: (1.188-1.189); FILE MERGED 2006/02/27 15:17:26 mba 1.188.34.1: #132394#: remove superfluous code

--- desktop/source/app/app.cxx
+++ desktop/source/app/app.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: app.cxx,v $
  *
- *  $Revision: 1.190 $
+ *  $Revision: 1.191 $
  *
- *  last change: $Author: obo $ $Date: 2006-03-24 13:51:32 $
+ *  last change: $Author: rt $ $Date: 2006-05-02 17:12:48 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.


Apply suggestions from code review

Apply suggestions from code review

Co-Authored-By: Yohann <322efd470ee11bd46d8b459d18c149ad8bfcf550@llnl.gov>

--- fem/bilininteg_hdiv.cpp
+++ fem/bilininteg_hdiv.cpp
@@ -263,11 +263,13 @@

             for (int dx = 0; dx < D1Dx; ++dx)
             {
+               double val = 0.0;
                for (int qx = 0; qx < Q1D; ++qx)
                {
                   const double wx = (c == 0) ? Bc(qx,dx) : Bo(qx,dx);
-                  diag(dx + (dy * D1Dx) + osc, e) += mass[qx] * wx * wx;
-               }
+                  val += mass[qx] * wx * wx;
+               }
+               diag(dx + (dy * D1Dx) + osc, e) += val;
             }
          }

@@ -327,12 +329,13 @@

                for (int dx = 0; dx < D1Dx; ++dx)
                {
+                  double val = 0.0;
                   for (int qx = 0; qx < Q1D; ++qx)
                   {
                      const double wx = (c == 0) ? Bc(qx,dx) : Bo(qx,dx);
-                     diag(dx + ((dy + (dz * D1Dy)) * D1Dx) + osc, e)
-                     += mass[qx] * wx * wx;
-                  }
+                     val += mass[qx] * wx * wx;
+                  }
+                  diag(dx + ((dy + (dz * D1Dy)) * D1Dx) + osc, e) += val;
                }
             }
          }
@@ -1000,11 +1003,13 @@

             for (int dx = 0; dx < D1Dx; ++dx)
             {
+               double val = 0.0;
                for (int qx = 0; qx < Q1D; ++qx)
                {
                   const double wx = (c == 0) ? Gc(qx,dx) : Bo(qx,dx);
-                  diag(dx + (dy * D1Dx) + osc, e) += div[qx] * wx * wx;
-               }
+                  val += div[qx] * wx * wx;
+               }
+               diag(dx + (dy * D1Dx) + osc, e) += val;
             }
          }

@@ -1063,12 +1068,13 @@

                for (int dx = 0; dx < D1Dx; ++dx)
                {
+                  double val = 0.0;
                   for (int qx = 0; qx < Q1D; ++qx)
                   {
                      const double wx = (c == 0) ? Gc(qx,dx) : Bo(qx,dx);
-                     diag(dx + ((dy + (dz * D1Dy)) * D1Dx) + osc, e) +=
-                        a[dx] * wx * wx;
-                  }
+                     val += a[dx] * wx * wx;
+                  }
+                  diag(dx + ((dy + (dz * D1Dy)) * D1Dx) + osc, e) += val;
                }
             }
          }
@@ -1889,10 +1895,12 @@
                   }  // loop c
                }  // loop qz

+               double val = 0.0;
                for (int i=0; i<3*D1D*(D1D - 1)*(D1D - 1); ++i)
                {
-                  diag(rx,ry,rz,e) += row[i] * row[i] * D(i,e);
-               }
+                  val += row[i] * row[i] * D(i,e);
+               }
+               diag(rx,ry,rz,e) += val;
             }  // loop rx
          }  // loop ry
       }  // loop rz
@@ -1980,10 +1988,12 @@
                }  // loop c
             }  // loop qy

+            double val = 0.0;
             for (int i=0; i<2*D1D*(D1D - 1); ++i)
             {
-               diag(rx,ry,e) += row[i] * row[i] * D(i,e);
-            }
+               val += row[i] * row[i] * D(i,e);
+            }
+            diag(rx,ry,e) += val;
          }  // loop rx
       }  // loop ry
    }); // end of element loop


Fix Mac build.

Fix Mac build.

R=sgjesse@google.com
BUG=
TEST=

Review URL: http://codereview.chromium.org//8375052

git-svn-id: c93d8a2297af3b929165606efe145742a534bc71@691 260f80e4-7a28-3924-810f-c04153c831b5

--- runtime/bin/file_macos.cc
+++ runtime/bin/file_macos.cc
@@ -8,6 +8,7 @@
 #include <unistd.h>
 #include <libgen.h>

+#include "bin/builtin.h"
 #include "bin/file.h"

 class FileHandle {


QmlDesigner: Fix short name

QmlDesigner: Fix short name

Change-Id: Ibec0a652c6c98d2695cb111f536ba293e238b04c
Reviewed-by: Marco Bubke <5254e489b34ec8bbce36789100e3fc0f41fa62ef@digia.com>

--- src/plugins/qmldesigner/designercore/exceptions/exception.cpp
+++ src/plugins/qmldesigner/designercore/exceptions/exception.cpp
@@ -162,8 +162,8 @@
 */
 void Exception::showException(const QString &title) const
 {
-    QString t = title.isEmpty() ? QCoreApplication::translate("QmlDesigner", "Error") : title;
-    showAsyncWarning(t, description());
+    QString composedTitle = title.isEmpty() ? QCoreApplication::translate("QmlDesigner", "Error") : title;
+    showAsyncWarning(composedTitle, description());
 }

 /*!


Reset braces highlight positions when changing document.

--- src/Editor.cxx
+++ src/Editor.cxx
@@ -2,7 +2,7 @@
 /** @file Editor.cxx
  ** Main code for the edit control.
  **/
-// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
+// Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.

 #include <stdlib.h>
@@ -5238,6 +5238,9 @@
 	targetStart = 0;
 	targetEnd = 0;

+	braces[0] = invalidPosition;
+	braces[1] = invalidPosition;
+
 	// Reset the contraction state to fully shown.
 	cs.Clear();
 	cs.InsertLines(0, pdoc->LinesTotal() - 1);


ugh release sequences

ugh release sequences

--- case_studies/epoch_rmc.cpp
+++ case_studies/epoch_rmc.cpp
@@ -27,8 +27,6 @@
     PEDGE(enter, body);

     uintptr_t new_count = in_critical_ + 1;
-    // XXX: THIS IS ACTUALLY FUCKED BECAUSE WE DO NOT HAVE FUCKING
-    // RELEASE SEQUENCES
     L(enter, in_critical_ = new_count);
     // Nothing to do if we were already in a critical section
     if (new_count > 1) return false;
@@ -55,15 +53,20 @@
 }

 void Participant::exit() noexcept {
+    // This is actually super unfortunate. quickEnter() will
+    // subsequently write to in_critical_, and we need the body of a
+    // critical section to be visible to code that reads from that
+    // subsequent write as well as this one.
+    // In C++11, we would make the write to in_critical_ be a release
+    // and the convoluted release sequence rules would save us.
     VEDGE(pre, exit);
+    LPOST(exit);
     uintptr_t new_count = in_critical_ - 1;
-    L(exit, in_critical_ = new_count);
+    L(__exit, in_critical_ = new_count);
 }

 bool Participant::tryCollect() {
     XEDGE(load_head, a);
-    // This could maybe be XEDGE but making it VEDGE lets us make the
-    // invariant -vt-> based.
     VEDGE(a, update_epoch);
     VEDGE(update_epoch, collect); // XXX: discount double check
     XEDGE(collect, update_local);


debuglevels: do not iterate over a directory whose 'open' returned a failure - prevents later assertions from the OSL implementation

--- desktop/source/app/app.cxx
+++ desktop/source/app/app.cxx
@@ -633,7 +633,9 @@
     else if( TypeToCopy == +1 ) // Folder
     {
         osl::Directory aDir( srcUnqPath );
-        aDir.open();
+        err = aDir.open();
+        if ( err != osl::FileBase::E_None )
+            return err;

         err = osl::Directory::create( dstUnqPath );
         osl::FileBase::RC next = err;


P4 to Git Change 1294133 by gandryey@gera-w8 on 2016/07/21 17:22:33

	SWDEV-95007 - OpenCL on PAL (Windows)
	- Disable GPU backend with PAL compilation. It was unintentionally enabled with CL#1293210

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#197 edit

--- runtime/device/device.cpp
+++ runtime/device/device.cpp
@@ -184,7 +184,7 @@
         ret |= roc::NullDevice::init();
     }
 #endif // WITH_HSA_DEVICE
-#if defined(WITH_GPU_DEVICE)
+#if defined(WITH_GPU_DEVICE) && !defined(WITH_PAL_DEVICE)
     ret |= DeviceLoad();
 #endif // WITH_GPU_DEVICE
 #if defined(WITH_PAL_DEVICE)
@@ -213,7 +213,7 @@
         rocAppProfile_ = NULL;
     }
 #endif // WITH_HSA_DEVICE
-#if defined(WITH_GPU_DEVICE)
+#if defined(WITH_GPU_DEVICE) && !defined(WITH_PAL_DEVICE)
     DeviceUnload();
 #endif // WITH_GPU_DEVICE
 #if defined(WITH_PAL_DEVICE)


QtQuickUI: Adapt wizard to only show up if Qt 5 is registered

Task-number: QTCREATORBUG-8336
Change-Id: I48c646f4594b47807da1f01c8871d72f36834166
Reviewed-by: Thomas Hartmann <588ee739c05aab7547907becfd1420d2b7316069@digia.com>

--- src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp
+++ src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp
@@ -65,7 +65,7 @@

 Core::FeatureSet QmlProjectApplicationWizard::requiredFeatures() const
 {
-    return Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK) | Core::Feature(QtSupport::Constants::FEATURE_QMLPROJECT);
+    return Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_2) | Core::Feature(QtSupport::Constants::FEATURE_QMLPROJECT);
 }

 Core::BaseFileWizardParameters QmlProjectApplicationWizard::parameters()


Move flag file extensions/bundled/buildid -> extensions/buildid

...it does not only control bundled extensions.

Change-Id: Idc4c9d3c6788fc77e90aa2478d50f2b0151a1238


legion: more fixes for bounds checks

legion: more fixes for bounds checks

--- runtime/legion/legion.inl
+++ runtime/legion/legion.inl
@@ -636,7 +636,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region),
+        : field(fid), field_region(&region),
           bounds(region.template get_bounds<N,T>())
       {
         DomainT<N,T> is;
@@ -653,14 +653,14 @@
       inline FT read(const Point<N,T>& p) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_ONLY);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_ONLY);
           return accessor.read(p);
         }
       inline const Realm::AccessorRefHelper<FT>
           operator[](const Point<N,T>& p) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_ONLY);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_ONLY);
           return accessor[p];
         }
       inline ArraySyntax::GenericSyntaxHelper<FieldAccessor<READ_ONLY,FT,N,T,
@@ -674,7 +674,7 @@
     public:
       mutable Realm::GenericAccessor<FT,N,T> accessor;
       FieldID field;
-      PhysicalRegion field_region;
+      const PhysicalRegion *field_region;
       DomainT<N,T> bounds;
     public:
       typedef FT value_type;
@@ -746,7 +746,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region),
+        : field(fid), field_region(&region),
           bounds(region.template get_bounds<1,T>())
       {
         DomainT<1,T> is;
@@ -763,20 +763,20 @@
       inline FT read(const Point<1,T>& p) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_ONLY);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_ONLY);
           return accessor.read(p);
         }
       inline const Realm::AccessorRefHelper<FT>
           operator[](const Point<1,T>& p) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_ONLY);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_ONLY);
           return accessor[p];
         }
     public:
       mutable Realm::GenericAccessor<FT,1,T> accessor;
       FieldID field;
-      PhysicalRegion field_region;
+      const PhysicalRegion *field_region;
       DomainT<1,T> bounds;
     public:
       typedef FT value_type;
@@ -859,7 +859,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region),
+        : field(fid), field_region(&region),
           bounds(region.template get_bounds<N,T>())
       {
         DomainT<N,T> is;
@@ -876,20 +876,20 @@
       inline FT read(const Point<N,T>& p) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_ONLY);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_ONLY);
           return accessor.read(p);
         }
       inline void write(const Point<N,T>& p, FT val) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field,WRITE_DISCARD);
+            field_region->fail_bounds_check(DomainPoint(p),field,WRITE_DISCARD);
           accessor.write(p, val);
         }
       inline Realm::AccessorRefHelper<FT>
           operator[](const Point<N,T>& p) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_WRITE);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_WRITE);
           return accessor[p];
         }
       inline ArraySyntax::GenericSyntaxHelper<FieldAccessor<READ_WRITE,FT,N,T,
@@ -904,7 +904,7 @@
     public:
       mutable Realm::GenericAccessor<FT,N,T> accessor;
       FieldID field;
-      PhysicalRegion field_region;
+      const PhysicalRegion *field_region;
       DomainT<N,T> bounds;
     public:
       typedef FT value_type;
@@ -980,7 +980,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region),
+        : field(fid), field_region(&region),
           bounds(region.template get_bounds<1,T>())
       {
         DomainT<1,T> is;
@@ -997,27 +997,27 @@
       inline FT read(const Point<1,T>& p) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_ONLY);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_ONLY);
           return accessor.read(p);
         }
       inline void write(const Point<1,T>& p, FT val) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field,WRITE_DISCARD);
+            field_region->fail_bounds_check(DomainPoint(p),field,WRITE_DISCARD);
           accessor.write(p, val);
         }
       inline Realm::AccessorRefHelper<FT>
           operator[](const Point<1,T>& p) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_WRITE);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_WRITE);
           return accessor[p];
         }
       // No reduction since we can't handle atomicity correctly
     public:
       mutable Realm::GenericAccessor<FT,1,T> accessor;
       FieldID field;
-      PhysicalRegion field_region;
+      const PhysicalRegion *field_region;
       DomainT<1,T> bounds;
     public:
       typedef FT value_type;
@@ -1100,7 +1100,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region),
+        : field(fid), field_region(&region),
           bounds(region.template get_bounds<N,T>())
       {
         DomainT<N,T> is;
@@ -1117,20 +1117,20 @@
       inline FT read(const Point<N,T>& p) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_ONLY);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_ONLY);
           return accessor.read(p);
         }
       inline void write(const Point<N,T>& p, FT val) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field,WRITE_DISCARD);
+            field_region->fail_bounds_check(DomainPoint(p),field,WRITE_DISCARD);
           accessor.write(p, val);
         }
       inline Realm::AccessorRefHelper<FT>
           operator[](const Point<N,T>& p) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_WRITE);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_WRITE);
           return accessor[p];
         }
       inline ArraySyntax::GenericSyntaxHelper<FieldAccessor<WRITE_DISCARD,FT,N,
@@ -1144,7 +1144,7 @@
     public:
       mutable Realm::GenericAccessor<FT,N,T> accessor;
       FieldID field;
-      PhysicalRegion field_region;
+      const PhysicalRegion *field_region;
       DomainT<N,T> bounds;
     public:
       typedef FT value_type;
@@ -1219,7 +1219,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region),
+        : field(fid), field_region(&region),
           bounds(region.template get_bounds<1,T>())
       {
         DomainT<1,T> is;
@@ -1236,26 +1236,26 @@
       inline FT read(const Point<1,T>& p) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_ONLY);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_ONLY);
           return accessor.read(p);
         }
       inline void write(const Point<1,T>& p, FT val) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field,WRITE_DISCARD);
+            field_region->fail_bounds_check(DomainPoint(p),field,WRITE_DISCARD);
           accessor.write(p, val);
         }
       inline Realm::AccessorRefHelper<FT>
           operator[](const Point<1,T>& p) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_WRITE);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_WRITE);
           return accessor[p];
         }
     public:
       mutable Realm::GenericAccessor<FT,1,T> accessor;
       FieldID field;
-      PhysicalRegion field_region;
+      const PhysicalRegion *field_region;
       DomainT<1,T> bounds;
     public:
       typedef FT value_type;
@@ -1334,7 +1334,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region),
+        : field(fid), field_region(&region),
           bounds(region.template get_bounds<N,T>())
       {
         DomainT<N,T> is;
@@ -1351,14 +1351,14 @@
       inline void write(const Point<N,T>& p, FT val) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field,WRITE_DISCARD);
+            field_region->fail_bounds_check(DomainPoint(p),field,WRITE_DISCARD);
           accessor.write(p, val);
         }
       inline Realm::AccessorRefHelper<FT>
           operator[](const Point<N,T>& p) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_WRITE);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_WRITE);
           return accessor[p];
         }
       inline ArraySyntax::GenericSyntaxHelper<FieldAccessor<WRITE_DISCARD,FT,N,
@@ -1372,7 +1372,7 @@
     public:
       mutable Realm::GenericAccessor<FT,N,T> accessor;
       FieldID field;
-      PhysicalRegion field_region;
+      const PhysicalRegion *field_region;
       DomainT<N,T> bounds;
     public:
       typedef FT value_type;
@@ -1443,7 +1443,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region),
+        : field(fid), field_region(&region),
           bounds(region.template get_bounds<1,T>())
       {
         DomainT<1,T> is;
@@ -1460,20 +1460,20 @@
       inline void write(const Point<1,T>& p, FT val) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field,WRITE_DISCARD);
+            field_region->fail_bounds_check(DomainPoint(p),field,WRITE_DISCARD);
           accessor.write(p, val);
         }
       inline Realm::AccessorRefHelper<FT>
           operator[](const Point<1,T>& p) const
         {
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_WRITE);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_WRITE);
           return accessor[p];
         }
     public:
       mutable Realm::GenericAccessor<FT,1,T> accessor;
       FieldID field;
-      PhysicalRegion field_region;
+      const PhysicalRegion *field_region;
       DomainT<1,T> bounds;
     public:
       typedef FT value_type;
@@ -1832,7 +1832,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<N,T> is;
         const Realm::RegionInstance instance =
@@ -1856,7 +1856,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<N,T> is;
         const Realm::RegionInstance instance =
@@ -1928,7 +1928,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_ONLY);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_ONLY);
 #endif
           return accessor.read(p);
         }
@@ -1939,7 +1939,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_ONLY);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_ONLY);
 #endif
           return accessor.ptr(p);
         }
@@ -1950,7 +1950,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, READ_ONLY);
+            field_region->fail_bounds_check(Domain(r), field, READ_ONLY);
 #endif
           if (!accessor.is_dense_arbitrary(r))
           {
@@ -1976,7 +1976,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, READ_ONLY);
+            field_region->fail_bounds_check(Domain(r), field, READ_ONLY);
 #endif
           for (int i = 0; i < N; i++)
             strides[i] = accessor.strides[i] / sizeof(FT);
@@ -1989,7 +1989,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_ONLY);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_ONLY);
 #endif
           return accessor[p];
         }
@@ -2005,7 +2005,7 @@
     public:
       Realm::AffineAccessor<FT,N,T> accessor;
       FieldID field;
-      PhysicalRegion field_region;
+      const PhysicalRegion *field_region;
       AffineBounds::Tester<N,T> bounds;
     public:
       typedef FT value_type;
@@ -2181,7 +2181,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<1,T> is;
         const Realm::RegionInstance instance =
@@ -2205,7 +2205,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<1,T> is;
         const Realm::RegionInstance instance =
@@ -2230,7 +2230,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<M,T> is;
         const Realm::RegionInstance instance =
@@ -2257,7 +2257,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<M,T> is;
         const Realm::RegionInstance instance =
@@ -2279,7 +2279,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_ONLY);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_ONLY);
 #endif
           return accessor.read(p);
         }
@@ -2290,7 +2290,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_ONLY);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_ONLY);
 #endif
           return accessor.ptr(p);
         }
@@ -2301,7 +2301,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, READ_ONLY);
+            field_region->fail_bounds_check(Domain(r), field, READ_ONLY);
 #endif
           if (!accessor.is_dense_arbitrary(r))
           {
@@ -2327,7 +2327,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, READ_ONLY);
+            field_region->fail_bounds_check(Domain(r), field, READ_ONLY);
 #endif
           strides[0] = accessor.strides[0] / sizeof(FT);
           return accessor.ptr(r.lo);
@@ -2339,14 +2339,14 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_ONLY);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_ONLY);
 #endif
           return accessor[p];
         }
     public:
       Realm::AffineAccessor<FT,1,T> accessor;
       FieldID field;
-      PhysicalRegion field_region;
+      const PhysicalRegion *field_region;
       AffineBounds::Tester<1,T> bounds;
     public:
       typedef FT value_type;
@@ -2542,7 +2542,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<N,T> is;
         const Realm::RegionInstance instance =
@@ -2566,7 +2566,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<N,T> is;
         const Realm::RegionInstance instance =
@@ -2591,7 +2591,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<M,T> is;
         const Realm::RegionInstance instance =
@@ -2618,7 +2618,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<M,T> is;
         const Realm::RegionInstance instance =
@@ -2640,7 +2640,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_ONLY);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_ONLY);
 #endif
           return accessor.read(p);
         }
@@ -2651,7 +2651,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field,WRITE_DISCARD);
+            field_region->fail_bounds_check(DomainPoint(p),field,WRITE_DISCARD);
 #endif
           accessor.write(p, val);
         }
@@ -2662,7 +2662,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_WRITE);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_WRITE);
 #endif
           return accessor.ptr(p);
         }
@@ -2673,7 +2673,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, READ_WRITE);
+            field_region->fail_bounds_check(Domain(r), field, READ_WRITE);
 #endif
           if (!accessor.is_dense_arbitrary(r))
           {
@@ -2699,7 +2699,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, READ_WRITE);
+            field_region->fail_bounds_check(Domain(r), field, READ_WRITE);
 #endif
           for (int i = 0; i < N; i++)
             strides[i] = accessor.strides[i] / sizeof(FT);
@@ -2712,7 +2712,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_WRITE);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_WRITE);
 #endif
           return accessor[p];
         }
@@ -2733,14 +2733,14 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, REDUCE);
+            field_region->fail_bounds_check(DomainPoint(p), field, REDUCE);
 #endif
           REDOP::template apply<EXCLUSIVE>(accessor[p], val);
         }
     public:
       Realm::AffineAccessor<FT,N,T> accessor;
       FieldID field;
-      PhysicalRegion field_region;
+      const PhysicalRegion *field_region;
       AffineBounds::Tester<N,T> bounds;
     public:
       typedef FT value_type;
@@ -2927,7 +2927,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<1,T> is;
         const Realm::RegionInstance instance =
@@ -2951,7 +2951,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<1,T> is;
         const Realm::RegionInstance instance =
@@ -2976,7 +2976,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<M,T> is;
         const Realm::RegionInstance instance =
@@ -3003,7 +3003,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<M,T> is;
         const Realm::RegionInstance instance =
@@ -3025,7 +3025,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_ONLY);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_ONLY);
 #endif
           return accessor.read(p);
         }
@@ -3036,7 +3036,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field,WRITE_DISCARD);
+            field_region->fail_bounds_check(DomainPoint(p),field,WRITE_DISCARD);
 #endif
           accessor.write(p, val);
         }
@@ -3047,7 +3047,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_WRITE);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_WRITE);
 #endif
           return accessor.ptr(p);
         }
@@ -3058,7 +3058,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, READ_WRITE);
+            field_region->fail_bounds_check(Domain(r), field, READ_WRITE);
 #endif
           if (!accessor.is_dense_arbitrary(r))
           {
@@ -3084,7 +3084,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, READ_WRITE);
+            field_region->fail_bounds_check(Domain(r), field, READ_WRITE);
 #endif
           strides[0] = accessor.strides[0] / sizeof(FT);
           return accessor.ptr(r.lo);
@@ -3096,7 +3096,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_WRITE);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_WRITE);
 #endif
           return accessor[p];
         }
@@ -3108,14 +3108,14 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, REDUCE);
+            field_region->fail_bounds_check(DomainPoint(p), field, REDUCE);
 #endif
           REDOP::template apply<EXCLUSIVE>(accessor[p], val);
         }
     public:
       Realm::AffineAccessor<FT,1,T> accessor;
       FieldID field;
-      PhysicalRegion field_region;
+      const PhysicalRegion *field_region;
       AffineBounds::Tester<1,T> bounds;
     public:
       typedef FT value_type;
@@ -3305,7 +3305,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<N,T> is;
         const Realm::RegionInstance instance =
@@ -3329,7 +3329,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<N,T> is;
         const Realm::RegionInstance instance =
@@ -3354,7 +3354,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<M,T> is;
         const Realm::RegionInstance instance =
@@ -3381,7 +3381,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<M,T> is;
         const Realm::RegionInstance instance =
@@ -3403,7 +3403,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_ONLY);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_ONLY);
 #endif
           return accessor.read(p);
         }
@@ -3414,7 +3414,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field,WRITE_DISCARD);
+            field_region->fail_bounds_check(DomainPoint(p),field,WRITE_DISCARD);
 #endif
           accessor.write(p, val);
         }
@@ -3425,7 +3425,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_WRITE);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_WRITE);
 #endif
           return accessor.ptr(p);
         }
@@ -3436,7 +3436,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, READ_WRITE);
+            field_region->fail_bounds_check(Domain(r), field, READ_WRITE);
 #endif
           if (!accessor.is_dense_arbitrary(r))
           {
@@ -3462,7 +3462,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, READ_WRITE);
+            field_region->fail_bounds_check(Domain(r), field, READ_WRITE);
 #endif
           for (int i = 0; i < N; i++)
             strides[i] = accessor.strides[i] / sizeof(FT);
@@ -3475,7 +3475,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_WRITE);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_WRITE);
 #endif
           return accessor[p];
         }
@@ -3491,7 +3491,7 @@
     public:
       Realm::AffineAccessor<FT,N,T> accessor;
       FieldID field;
-      PhysicalRegion field_region;
+      const PhysicalRegion *field_region;
       AffineBounds::Tester<N,T> bounds;
     public:
       typedef FT value_type;
@@ -3672,7 +3672,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<1,T> is;
         const Realm::RegionInstance instance =
@@ -3696,7 +3696,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<1,T> is;
         const Realm::RegionInstance instance =
@@ -3721,7 +3721,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<M,T> is;
         const Realm::RegionInstance instance =
@@ -3748,7 +3748,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<M,T> is;
         const Realm::RegionInstance instance =
@@ -3770,7 +3770,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_ONLY);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_ONLY);
 #endif
           return accessor.read(p);
         }
@@ -3781,7 +3781,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field,WRITE_DISCARD);
+            field_region->fail_bounds_check(DomainPoint(p),field,WRITE_DISCARD);
 #endif
           accessor.write(p, val);
         }
@@ -3792,7 +3792,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_WRITE);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_WRITE);
 #endif
           return accessor.ptr(p);
         }
@@ -3803,7 +3803,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, READ_WRITE);
+            field_region->fail_bounds_check(Domain(r), field, READ_WRITE);
 #endif
           if (!accessor.is_dense_arbitrary(r))
           {
@@ -3829,7 +3829,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, READ_WRITE);
+            field_region->fail_bounds_check(Domain(r), field, READ_WRITE);
 #endif
           strides[0] = accessor.strides[0] / sizeof(FT);
           return accessor.ptr(r.lo);
@@ -3841,14 +3841,14 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_WRITE);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_WRITE);
 #endif
           return accessor[p];
         }
     public:
       Realm::AffineAccessor<FT,1,T> accessor;
       FieldID field;
-      PhysicalRegion field_region;
+      const PhysicalRegion *field_region;
       AffineBounds::Tester<1,T> bounds;
     public:
       typedef FT value_type;
@@ -4033,7 +4033,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<N,T> is;
         const Realm::RegionInstance instance =
@@ -4057,7 +4057,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<N,T> is;
         const Realm::RegionInstance instance =
@@ -4082,7 +4082,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<M,T> is;
         const Realm::RegionInstance instance =
@@ -4106,7 +4106,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<M,T> is;
         const Realm::RegionInstance instance =
@@ -4128,7 +4128,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field,WRITE_DISCARD);
+            field_region->fail_bounds_check(DomainPoint(p),field,WRITE_DISCARD);
 #endif
           accessor.write(p, val);
         }
@@ -4139,7 +4139,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_WRITE);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_WRITE);
 #endif
           return accessor.ptr(p);
         }
@@ -4150,7 +4150,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, READ_WRITE);
+            field_region->fail_bounds_check(Domain(r), field, READ_WRITE);
 #endif
           if (!accessor.is_dense_arbitrary(r))
           {
@@ -4176,7 +4176,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, READ_WRITE);
+            field_region->fail_bounds_check(Domain(r), field, READ_WRITE);
 #endif
           for (int i = 0; i < N; i++)
             strides[i] = accessor.strides[i] / sizeof(FT);
@@ -4189,7 +4189,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_WRITE);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_WRITE);
 #endif
           return accessor[p];
         }
@@ -4205,7 +4205,7 @@
     public:
       Realm::AffineAccessor<FT,N,T> accessor;
       FieldID field;
-      PhysicalRegion field_region;
+      const PhysicalRegion *field_region;
       AffineBounds::Tester<N,T> bounds;
     public:
       typedef FT value_type;
@@ -4381,7 +4381,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<1,T> is;
         const Realm::RegionInstance instance =
@@ -4405,7 +4405,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<1,T> is;
         const Realm::RegionInstance instance =
@@ -4430,7 +4430,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<M,T> is;
         const Realm::RegionInstance instance =
@@ -4457,7 +4457,7 @@
 #endif
                     bool silence_warnings = false,
                     const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<M,T> is;
         const Realm::RegionInstance instance =
@@ -4479,7 +4479,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field,WRITE_DISCARD);
+            field_region->fail_bounds_check(DomainPoint(p),field,WRITE_DISCARD);
 #endif
           accessor.write(p, val);
         }
@@ -4490,7 +4490,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_WRITE);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_WRITE);
 #endif
           return accessor.ptr(p);
         }
@@ -4501,7 +4501,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, READ_WRITE);
+            field_region->fail_bounds_check(Domain(r), field, READ_WRITE);
 #endif
           if (!accessor.is_dense_arbitrary(r))
           {
@@ -4527,7 +4527,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, READ_WRITE);
+            field_region->fail_bounds_check(Domain(r), field, READ_WRITE);
 #endif
           strides[0] = accessor.strides[0] / sizeof(FT);
           return accessor.ptr(r.lo);
@@ -4539,14 +4539,14 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, READ_WRITE);
+            field_region->fail_bounds_check(DomainPoint(p), field, READ_WRITE);
 #endif
           return accessor[p];
         }
     public:
       Realm::AffineAccessor<FT,1,T> accessor;
       FieldID field;
-      PhysicalRegion field_region;
+      const PhysicalRegion *field_region;
       AffineBounds::Tester<1,T> bounds;
     public:
       typedef FT value_type;
@@ -4718,7 +4718,7 @@
       ReductionAccessor(const PhysicalRegion &region, FieldID fid,
                         ReductionOpID redop, bool silence_warnings = false,
                         const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<N,T> is;
         const Realm::RegionInstance instance =
@@ -4739,7 +4739,7 @@
                         const Rect<N,T> source_bounds,
                         bool silence_warnings = false,
                         const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<N,T> is;
         const Realm::RegionInstance instance =
@@ -4761,7 +4761,7 @@
                         const AffineTransform<M,N,T> transform,
                         bool silence_warnings = false,
                         const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<M,T> is;
         const Realm::RegionInstance instance =
@@ -4785,7 +4785,7 @@
                         const Rect<N,T> source_bounds,
                         bool silence_warnings = false,
                         const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<M,T> is;
         const Realm::RegionInstance instance =
@@ -4809,7 +4809,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, REDUCE);
+            field_region->fail_bounds_check(DomainPoint(p), field, REDUCE);
 #endif
           REDOP::template fold<EXCLUSIVE>(accessor[p], val);
         }
@@ -4820,7 +4820,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, REDUCE);
+            field_region->fail_bounds_check(DomainPoint(p), field, REDUCE);
 #endif
           return accessor.ptr(p);
         }
@@ -4831,7 +4831,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, REDUCE);
+            field_region->fail_bounds_check(Domain(r), field, REDUCE);
 #endif
           if (!accessor.is_dense_arbitrary(r))
           {
@@ -4858,7 +4858,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, REDUCE);
+            field_region->fail_bounds_check(Domain(r), field, REDUCE);
 #endif
           for (int i = 0; i < N; i++)
             strides[i] = accessor.strides[i] / sizeof(typename REDOP::RHS);
@@ -4888,7 +4888,7 @@
     public:
       Realm::AffineAccessor<typename REDOP::RHS,N,T> accessor;
       FieldID field;
-      PhysicalRegion field_region;
+      const PhysicalRegion *field_region;
       AffineBounds::Tester<N,T> bounds;
     public:
       typedef typename REDOP::RHS value_type;
@@ -5050,7 +5050,7 @@
       ReductionAccessor(const PhysicalRegion &region, FieldID fid,
                         ReductionOpID redop, bool silence_warnings = false,
                         const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<1,T> is;
         const Realm::RegionInstance instance =
@@ -5071,7 +5071,7 @@
                         const Rect<1,T> source_bounds,
                         bool silence_warnings = false,
                         const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<1,T> is;
         const Realm::RegionInstance instance =
@@ -5093,7 +5093,7 @@
                         const AffineTransform<M,1,T> transform,
                         bool silence_warnings = false,
                         const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<M,T> is;
         const Realm::RegionInstance instance =
@@ -5116,7 +5116,7 @@
                         const Rect<1,T> source_bounds,
                         bool silence_warnings = false,
                         const char *warning_string = NULL)
-        : field(fid), field_region(region)
+        : field(fid), field_region(&region)
       {
         DomainT<M,T> is;
         const Realm::RegionInstance instance =
@@ -5140,7 +5140,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, REDUCE);
+            field_region->fail_bounds_check(DomainPoint(p), field, REDUCE);
 #endif
           REDOP::template fold<EXCLUSIVE>(accessor[p], val);
         }
@@ -5151,7 +5151,7 @@
           assert(bounds.contains(p));
 #else
           if (!bounds.contains(p))
-            field_region.fail_bounds_check(DomainPoint(p), field, REDUCE);
+            field_region->fail_bounds_check(DomainPoint(p), field, REDUCE);
 #endif
           return accessor.ptr(p);
         }
@@ -5162,7 +5162,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, REDUCE);
+            field_region->fail_bounds_check(Domain(r), field, REDUCE);
 #endif
           if (!accessor.is_dense_arbitrary(r))
           {
@@ -5189,7 +5189,7 @@
           assert(bounds.contains_all(r));
 #else
           if (!bounds.contains_all(r))
-            field_region.fail_bounds_check(Domain(r), field, REDUCE);
+            field_region->fail_bounds_check(Domain(r), field, REDUCE);
 #endif
           strides[0] = accessor.strides[0] / sizeof(typename REDOP::RHS);
           return accessor.ptr(r.lo);
@@ -5207,7 +5207,7 @@
     public:
       Realm::AffineAccessor<typename REDOP::RHS,1,T> accessor;
       FieldID field;
-      PhysicalRegion field_region;
+      const PhysicalRegion *field_region;
       AffineBounds::Tester<1,T> bounds;
     public:
       typedef typename REDOP::RHS value_type;


Fix bug where indentation guide is drawn over text when the indentation is in a different style to the default style so spaces are different widths.

--- src/Editor.cxx
+++ src/Editor.cxx
@@ -2840,6 +2840,8 @@
 	if ((vsDraw.viewIndentationGuides == ivLookForward || vsDraw.viewIndentationGuides == ivLookBoth)
 	        && (subLine == 0)) {
 		int indentSpace = pdoc->GetLineIndentation(line);
+		int xStartText = ll->positions[pdoc->GetLineIndentPosition(line) - posLineStart];
+
 		// Find the most recent line with some text

 		int lineLastWithText = line;
@@ -2847,6 +2849,7 @@
 			lineLastWithText--;
 		}
 		if (lineLastWithText < line) {
+			xStartText = 100000;	// Don't limit to visible indentation on empty line
 			// This line is empty, so use indentation of last line with text
 			int indentLastWithText = pdoc->GetLineIndentation(lineLastWithText);
 			int isFoldHeader = pdoc->GetLevel(lineLastWithText) & SC_FOLDLEVELHEADERFLAG;
@@ -2876,8 +2879,10 @@

 		for (int indentPos = pdoc->IndentSize(); indentPos < indentSpace; indentPos += pdoc->IndentSize()) {
 			int xIndent = indentPos * vsDraw.spaceWidth;
-			DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcSegment,
-			        (ll->xHighlightGuide == xIndent));
+			if (xIndent < xStartText) {
+				DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcSegment,
+					(ll->xHighlightGuide == xIndent));
+			}
 		}
 	}


- fixed mouse pointer movement by using delayed one if no move is present - fixed USB port numbers according to the specs

--- iodev/pciusb.cc
+++ iodev/pciusb.cc
@@ -314,13 +314,13 @@
       val = BX_USB_THIS hub[0].usb_sof.sof_timing;
       break;

-    case 0x14: // port2 non existant, but linux systems check it to see if there are more than 2
-      BX_ERROR(("read from non existant port 0x14 (port 2)"));
-      val = 0xFF7F;  //TODO: if non existant, does it return 0xFF7F
-      break;
-
-    case 0x10: // port0
-    case 0x12: // port1
+    case 0x14: // port #3 non existant, but linux systems check it to see if there are more than 2
+      BX_ERROR(("read from non existant offset 0x14 (port #3)"));
+      val = 0xFF7F;
+      break;
+
+    case 0x10: // port #1
+    case 0x12: // port #2
       port = (offset & 0x0F) >> 1;
       if (port < USB_NUM_PORTS) {
         val = BX_USB_THIS hub[0].usb_port[port].suspend << 12
@@ -485,22 +485,22 @@
        BX_USB_THIS hub[0].usb_sof.sof_timing = value;
        break;

-    case 0x14: // port2 non existant, but linux systems check it to see if there are more than 2
-      BX_ERROR(("write from non existant port 0x14 (port 2)"));
-      break;
-
-    case 0x10: // port0
-    case 0x12: // port1
+    case 0x14: // port #3 non existant, but linux systems check it to see if there are more than 2
+      BX_ERROR(("write to non existant offset 0x14 (port #3)"));
+      break;
+
+    case 0x10: // port #1
+    case 0x12: // port #2
       port = (offset & 0x0F) >> 1;
       if (port < USB_NUM_PORTS) {
         if (value & ((1<<5) | (1<<4) | (1<<0)))
-          BX_DEBUG(("write to one or more read-only bits in port%d register: 0x%04x", port, value));
+          BX_DEBUG(("write to one or more read-only bits in port #%d register: 0x%04x", port+1, value));
         if (!(value & (1<<7)))
-          BX_DEBUG(("write to port%d register bit 7 = 0", port));
+          BX_DEBUG(("write to port #%d register bit 7 = 0", port+1));
         if (value & (1<<8))
-          BX_DEBUG(("write to bit 8 in port%d register ignored", port));
+          BX_DEBUG(("write to bit 8 in port #%d register ignored", port+1));
         if ((value & (1<<12)) && BX_USB_THIS hub[0].usb_command.suspend)
-          BX_DEBUG(("write to port%d register bit 12 when in Global-Suspend", port));
+          BX_DEBUG(("write to port #%d register bit 12 when in Global-Suspend", port+1));

         BX_USB_THIS hub[0].usb_port[port].suspend = (value & (1<<12)) ? 1 : 0;
         BX_USB_THIS hub[0].usb_port[port].reset = (value & (1<<9)) ? 1 : 0;
@@ -520,7 +520,7 @@
           // are we are currently connected/disconnected
           BX_USB_THIS hub[0].device[BX_USB_THIS hub[0].usb_port[port].device_num].connect_status = 0;
           usb_set_connect_status(BX_USB_THIS hub[0].device[BX_USB_THIS hub[0].usb_port[port].device_num].dev_type, 1);
-          BX_DEBUG(("Port Reset"));
+          BX_DEBUG(("Port #%d: Reset", port+1));
         }
         break;
       }
@@ -780,6 +780,10 @@
               break;

             case 2:  // mouse
+              if (!BX_USB_THIS mouse_x && !BX_USB_THIS mouse_y) {
+                // if there's no new movement, handle delayed one
+                BX_USB_THIS usb_mouse_enq(0, 0, BX_USB_THIS mouse_z, BX_USB_THIS b_state);
+              }
               device_buffer[0] = (Bit8u) BX_USB_THIS b_state;
               device_buffer[1] = (Bit8s) BX_USB_THIS mouse_x;
               device_buffer[2] = (Bit8s) BX_USB_THIS mouse_y;
@@ -787,7 +791,7 @@
               BX_USB_THIS b_state = 0;
               BX_USB_THIS mouse_x = 0;
               BX_USB_THIS mouse_y = 0;
-              BX_USB_THIS mouse_z = 0;  // if wheel mouse
+              BX_USB_THIS mouse_z = 0;
               BX_MEM_WRITE_PHYSICAL(td->dword3, cnt, device_buffer);
               BX_USB_THIS set_status(td, 0, 0, 0, 0, 0, 0, cnt-1);
               break;


legion: avoid duplicate deletion of custom projection functions when running with multiple runtime instances per process

--- runtime/legion/runtime.cc
+++ runtime/legion/runtime.cc
@@ -8957,13 +8957,18 @@
         delete it->second;
       }
       proc_managers.clear();
-      for (std::map<ProjectionID,ProjectionFunction*>::
-            iterator it = projection_functions.begin();
-            it != projection_functions.end(); it++)
-      {
-        delete it->second;
-      }
-      projection_functions.clear();
+      // Avoid duplicate deletions on these for separate runtime
+      // instances by just leaking them for now
+      if (!separate_runtime_instances)
+      {
+        for (std::map<ProjectionID,ProjectionFunction*>::
+              iterator it = projection_functions.begin();
+              it != projection_functions.end(); it++)
+        {
+          delete it->second;
+        }
+        projection_functions.clear();
+      }
       for (std::deque<IndividualTask*>::const_iterator it =
             available_individual_tasks.begin();
             it != available_individual_tasks.end(); it++)


Stop backspace destroying protected range. Bug #3445911. From Averk.

--- src/Editor.cxx
+++ src/Editor.cxx
@@ -4254,7 +4254,7 @@
 		}
 		UndoGroup ug(pdoc, (sel.Count() > 1) || singleVirtual);
 		for (size_t r=0; r<sel.Count(); r++) {
-			if (!RangeContainsProtected(sel.Range(r).caret.Position(), sel.Range(r).caret.Position() + 1)) {
+			if (!RangeContainsProtected(sel.Range(r).caret.Position()-1, sel.Range(r).caret.Position())) {
 				if (sel.Range(r).Start().VirtualSpace()) {
 					if (sel.Range(r).anchor < sel.Range(r).caret)
 						sel.Range(r) = SelectionPosition(InsertSpace(sel.Range(r).anchor.Position(), sel.Range(r).anchor.VirtualSpace()));