folly/futures: keep Core alive until callback has returned
Summary:Callbacks passed to e.g. folly::Future::then (or folly::Future::ensure) may delete the promise that keeps the Core of the same future alive. The Core must protect itself from destruction during callback execution. This commit also adds a unit test to check for correct behaviour in the "self destruction" scenario. The test should usually pass even without the fix in Core.h. However, when you run the test in Valgrind or ASAN, it will report problems unless the fix in Core.h is applied. Reviewed By: mhx Differential Revision: D2938094 fb-gh-sync-id: 22796e168e1876ef2e3c7d7619da020be6a22073 shipit-source-id: 22796e168e1876ef2e3c7d7619da020be6a22073
Showing
Please register or sign in to comment