Refactor NativeMapView to hold std::unique_ptr to Map and DefaultFileSource

Add missing asserts to attach_jni_thread/detach_jni_thread
Fixes #2406
This commit is contained in:
Leith Bade
2015-09-24 12:18:59 +10:00
parent f6a784ce8c
commit 3de441f20e
3 changed files with 31 additions and 20 deletions

View File

@@ -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);