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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user