Back out "Use atomic pointer for animationDelegate_ to prevent race during teardown"

Summary:
Changelog: [internal]

Original commit changeset: 6cb898caf7c2

This change doesn't fix LayoutAnimation crashes. Let's back it out.

Reviewed By: fkgozali

Differential Revision: D29909973

fbshipit-source-id: 34926ace220e6b269bb938a3da72c977b0608187
This commit is contained in:
Samuel Susla
2021-07-26 10:19:22 -07:00
committed by Facebook GitHub Bot
parent cfd425406a
commit 110ef5bf30
2 changed files with 7 additions and 9 deletions
@@ -341,9 +341,8 @@ void UIManager::configureNextLayoutAnimation(
RawValue const &config,
jsi::Value const &successCallback,
jsi::Value const &failureCallback) const {
auto animationDelegate = animationDelegate_.load();
if (animationDelegate) {
animationDelegate->uiManagerDidConfigureNextLayoutAnimation(
if (animationDelegate_) {
animationDelegate_->uiManagerDidConfigureNextLayoutAnimation(
runtime,
config,
std::move(successCallback),
@@ -431,15 +430,14 @@ void UIManager::setAnimationDelegate(UIManagerAnimationDelegate *delegate) {
}
void UIManager::stopSurfaceForAnimationDelegate(SurfaceId surfaceId) const {
auto animationDelegate = animationDelegate_.load();
if (animationDelegate) {
animationDelegate->stopSurface(surfaceId);
if (animationDelegate_ != nullptr) {
animationDelegate_->stopSurface(surfaceId);
}
}
void UIManager::animationTick() {
auto animationDelegate = animationDelegate_.load();
if (animationDelegate && animationDelegate->shouldAnimateFrame()) {
if (animationDelegate_ != nullptr &&
animationDelegate_->shouldAnimateFrame()) {
shadowTreeRegistry_.enumerate(
[&](ShadowTree const &shadowTree, bool &stop) {
shadowTree.notifyDelegatesOfUpdates();
@@ -185,7 +185,7 @@ class UIManager final : public ShadowTreeDelegate {
SharedComponentDescriptorRegistry componentDescriptorRegistry_;
UIManagerDelegate *delegate_;
std::atomic<UIManagerAnimationDelegate *> animationDelegate_{nullptr};
UIManagerAnimationDelegate *animationDelegate_{nullptr};
RuntimeExecutor const runtimeExecutor_{};
ShadowTreeRegistry shadowTreeRegistry_{};
BackgroundExecutor const backgroundExecutor_{};