fix: Use ThreadScope::WithClassLoader
to also load custom JNI Types (#2461)
* fix: Fix `ThreadScope` in `runAsync` * fix: Use `&` * Update JVisionCameraScheduler.cpp
This commit is contained in:
parent
33e2adcec6
commit
9e1297531e
@ -22,10 +22,11 @@ void JVisionCameraScheduler::dispatchAsync(const std::function<void()>& job) {
|
||||
|
||||
void JVisionCameraScheduler::scheduleTrigger() {
|
||||
// 2.1 Open a JNI Thread scope because this might be called from a C++ background Thread
|
||||
jni::ThreadScope scope;
|
||||
jni::ThreadScope::WithClassLoader([&]() {
|
||||
// 2.2 schedule `triggerUI` to be called on the java thread
|
||||
static auto method = _javaPart->getClass()->getMethod<void()>("scheduleTrigger");
|
||||
method(_javaPart.get());
|
||||
});
|
||||
}
|
||||
|
||||
void JVisionCameraScheduler::trigger() {
|
||||
|
Loading…
Reference in New Issue
Block a user