fix: Fix Unable to retrieve jni environment. Is the thread attached?
errors by using jni::ThreadScope
(#2457)
fix: Add `jni::ThreadScope` to `JVisionCameraScheduler`
This commit is contained in:
parent
9089014ed8
commit
33e2adcec6
@ -21,7 +21,9 @@ void JVisionCameraScheduler::dispatchAsync(const std::function<void()>& job) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void JVisionCameraScheduler::scheduleTrigger() {
|
void JVisionCameraScheduler::scheduleTrigger() {
|
||||||
// 2. schedule `triggerUI` to be called on the java thread
|
// 2.1 Open a JNI Thread scope because this might be called from a C++ background Thread
|
||||||
|
jni::ThreadScope scope;
|
||||||
|
// 2.2 schedule `triggerUI` to be called on the java thread
|
||||||
static auto method = _javaPart->getClass()->getMethod<void()>("scheduleTrigger");
|
static auto method = _javaPart->getClass()->getMethod<void()>("scheduleTrigger");
|
||||||
method(_javaPart.get());
|
method(_javaPart.get());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user