summaryrefslogtreecommitdiff
path: root/platform/android/src
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2017-03-30 14:53:59 +0300
committerIvo van Dongen <ivovandongen@users.noreply.github.com>2017-03-30 15:27:05 +0300
commit8aa625bf96299583298fbd034dc702acf0f49882 (patch)
tree6f4fc36911a05607dd8ae91986256181b1a9744c /platform/android/src
parenta82779917454269c99b490dc1e2e6c9efafa2e9e (diff)
downloadqtlocation-mapboxgl-8aa625bf96299583298fbd034dc702acf0f49882.tar.gz
[android] execute resource transform callback on the right thread
Diffstat (limited to 'platform/android/src')
-rw-r--r--platform/android/src/file_source.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/platform/android/src/file_source.cpp b/platform/android/src/file_source.cpp
index 30e1ff50fe..20715bf920 100644
--- a/platform/android/src/file_source.cpp
+++ b/platform/android/src/file_source.cpp
@@ -46,10 +46,10 @@ void FileSource::setResourceTransform(jni::JNIEnv& env, jni::Object<FileSource::
// a subsequent call.
// Note: we're converting it to shared_ptr because this lambda is converted to a std::function,
// which requires copyability of its captured variables.
- callback = std::shared_ptr<jni::jobject>(transformCallback.NewGlobalRef(env).release()->Get(), GenericGlobalRefDeleter()),
- env
+ callback = std::shared_ptr<jni::jobject>(transformCallback.NewGlobalRef(env).release()->Get(), GenericGlobalRefDeleter())
](mbgl::Resource::Kind kind, std::string&& url_) {
- return FileSource::ResourceTransformCallback::onURL(const_cast<jni::JNIEnv&>(env), jni::Object<FileSource::ResourceTransformCallback>(*callback), int(kind), url_);
+ android::UniqueEnv _env = android::AttachEnv();
+ return FileSource::ResourceTransformCallback::onURL(*_env, jni::Object<FileSource::ResourceTransformCallback>(*callback), int(kind), url_);
});
} else {
// Reset the callback