diff options
author | Leith Bade <leith@mapbox.com> | 2015-09-24 12:18:59 +1000 |
---|---|---|
committer | Leith Bade <leith@mapbox.com> | 2015-09-24 12:22:19 +1000 |
commit | 2c4a9f6a3be8945559f127adb8695a11d833cd89 (patch) | |
tree | 442e4cac33bfd19c9fb349ca27c6e7509941caf1 /android/cpp/jni.cpp | |
parent | 18bc490f40e997bc2a1cbaa2cf82a9ffd2fa2405 (diff) | |
download | qtlocation-mapboxgl-2c4a9f6a3be8945559f127adb8695a11d833cd89.tar.gz |
Refactor NativeMapView to hold std::unique_ptr to Map and DefaultFileSource
Add missing asserts to attach_jni_thread/detach_jni_thread
Fixes #2406
Diffstat (limited to 'android/cpp/jni.cpp')
-rw-r--r-- | android/cpp/jni.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index 140cc9f3ca..5ed0a730c3 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -117,6 +117,9 @@ bool throw_jni_error(JNIEnv *env, const char *msg) { } bool attach_jni_thread(JavaVM* vm, JNIEnv** env, std::string threadName) { + assert(vm != nullptr); + assert(env != nullptr); + JavaVMAttachArgs args = {JNI_VERSION_1_2, threadName.c_str(), NULL}; jint ret; @@ -142,6 +145,9 @@ bool attach_jni_thread(JavaVM* vm, JNIEnv** env, std::string threadName) { void detach_jni_thread(JavaVM* vm, JNIEnv** env, bool detach) { if (detach) { + assert(vm != nullptr); + assert(env != nullptr); + jint ret; if ((ret = vm->DetachCurrentThread()) != JNI_OK) { mbgl::Log::Error(mbgl::Event::JNI, "DetachCurrentThread() failed with %i", ret); |