Remove NativeRunnables from local references table.

Differential Revision: D2620026

fb-gh-sync-id: c105143d3ad932abcaff1407c6434148221753c4
This commit is contained in:
Mike Armstrong 2015-11-04 20:31:48 -08:00 committed by facebook-github-bot-4
parent a4cc0c3ffd
commit 66f7feda4d
1 changed files with 5 additions and 5 deletions

View File

@ -520,14 +520,14 @@ namespace runnable {
static jclass gNativeRunnableClass;
static jmethodID gNativeRunnableCtor;
static jobject createNativeRunnable(JNIEnv* env, decltype(NativeRunnable::callable)&& callable) {
jobject jRunnable = env->NewObject(gNativeRunnableClass, gNativeRunnableCtor);
static LocalReference<jobject> createNativeRunnable(JNIEnv* env, decltype(NativeRunnable::callable)&& callable) {
LocalReference<jobject> jRunnable{env->NewObject(gNativeRunnableClass, gNativeRunnableCtor)};
if (env->ExceptionCheck()) {
return nullptr;
}
auto nativeRunnable = createNew<NativeRunnable>();
nativeRunnable->callable = std::move(callable);
setCountableForJava(env, jRunnable, std::move(nativeRunnable));
setCountableForJava(env, jRunnable.get(), std::move(nativeRunnable));
return jRunnable;
}
@ -602,8 +602,8 @@ static void dispatchCallbacksToJava(const RefPtr<WeakReference>& weakCallback,
}
}, std::move(calls));
jobject jNativeRunnable = runnable::createNativeRunnable(env, std::move(runnableFunction));
queue::enqueueNativeRunnableOnQueue(env, callbackQueueThread, jNativeRunnable);
auto jNativeRunnable = runnable::createNativeRunnable(env, std::move(runnableFunction));
queue::enqueueNativeRunnableOnQueue(env, callbackQueueThread, jNativeRunnable.get());
}
static void create(JNIEnv* env, jobject obj, jobject executor, jobject callback,