Copy weak reference to callback object when dispatching calls to Java

Summary: The bridge could be destructed, meaning we can't try to resolve member variables of PlatformBridgeCallback.

Reviewed By: lexs

Differential Revision: D3005994

fb-gh-sync-id: f83de432148ce62fd1060c6b84ec39ad2fa10a55
shipit-source-id: f83de432148ce62fd1060c6b84ec39ad2fa10a55
This commit is contained in:
Andy Street 2016-03-03 07:51:51 -08:00 committed by Facebook Github Bot 0
parent 32dd1fe35a
commit 7fb33032f6
1 changed files with 2 additions and 2 deletions

View File

@ -629,13 +629,13 @@ public:
return;
}
auto runnableWrapper = std::bind([this] (std::function<void(ResolvedWeakReference&)>& runnable) {
auto runnableWrapper = std::bind([weakCallback=weakCallback_] (std::function<void(ResolvedWeakReference&)>& runnable) {
auto env = Environment::current();
if (env->ExceptionCheck()) {
FBLOGW("Dropped calls because of pending exception");
return;
}
ResolvedWeakReference callback(weakCallback_);
ResolvedWeakReference callback(weakCallback);
if (callback) {
runnable(callback);
}