Use an atomic bool to track bridge destruction

Summary: We're seeing intermittent crashes in ~Bridge() where m_destroyed isn't set. This could be because the value of m_destroyed is cached for the destructing thread and doesn't see that the value got updated. Using an atomic boolean should fix this.

Reviewed By: mhorowitz

Differential Revision: D3126701

fb-gh-sync-id: 5887edef748cc05971765943de80187ab7fd8ede
fbshipit-source-id: 5887edef748cc05971765943de80187ab7fd8ede
This commit is contained in:
Andy Street authored and Facebook Github Bot 7 committed 2016-04-05 13:24:31 -07:00
1 parent e8e8e8acdc
commit c0108a269d
3 files changed
+13 -7

No files matched your search

@@ -406,6 +406,12 @@ public class CatalystInstanceImpl implements CatalystInstance {
}
}
@Override
protected void finalize() throws Throwable {
Assertions.assertCondition(mDestroyed, "Bridge was not destroyed before finalizer!");
super.finalize();
}
private class NativeModulesReactCallback implements ReactCallback {
@Override