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
2016-04-05 13:23:00 -07:00
committed by Facebook Github Bot 7
parent e8e8e8acdc
commit c0108a269d
3 changed files with 13 additions and 7 deletions

View File

@@ -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