Fix a race in Observable context destruction
authorAndrii Grynenko <andrii@fb.com>
Mon, 1 May 2017 21:51:49 +0000 (14:51 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Mon, 1 May 2017 22:05:36 +0000 (15:05 -0700)
commit2642bd3dcf9658be7da3e5b5bc622fe051200e97
treeff9f984baafc4b0d8dc9d5f4cff95495aeb5077c
parent79cb7776b1727ff98e5e53b049acc608c2cdda05
Fix a race in Observable context destruction

Summary: In the subscribe callback It's possible that we lock the Context shared_ptr and while update is running, all other shared_ptr's are released. This will result in Context to be destroyed from the wrong thread (thread runnning subcribe callback), which is not desired.

Reviewed By: yfeldblum

Differential Revision: D4964605

fbshipit-source-id: 285327a6873ccb7393fa3067ba7e612c29dbc454
folly/experimental/observer/Observable-inl.h
folly/experimental/observer/Observer-inl.h
folly/experimental/observer/Observer.h
folly/experimental/observer/detail/ObserverManager.cpp
folly/experimental/observer/detail/ObserverManager.h
folly/experimental/observer/test/ObserverTest.cpp