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:
		| @@ -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; | ||||
|   // 2.2 schedule `triggerUI` to be called on the java thread | ||||
|   static auto method = _javaPart->getClass()->getMethod<void()>("scheduleTrigger"); | ||||
|   method(_javaPart.get()); | ||||
|   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() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user