mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix KERN_INVALID_ADDRESS in LayoutAnimation
Summary: Changelog: [Internal] # Problem `MountingCoordinator` holds a pointer to instance of `MountingOverrideDelegate` which becomes invalid. # Solution Use `std::weak_ptr` instead of raw pointer so it is possible to tell whether the pointer is expired. Reviewed By: JoshuaGross Differential Revision: D21905351 fbshipit-source-id: c7bf9635742a6ec086a03ba83202e46e1f1f373f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6de3fffc37
commit
9ebd852334
@@ -73,10 +73,6 @@ std::shared_ptr<Scheduler> Binding::getScheduler() {
|
||||
return scheduler_;
|
||||
}
|
||||
|
||||
LayoutAnimationDriver *Binding::getAnimationDriver() {
|
||||
return (animationDriver_ ? animationDriver_.get() : nullptr);
|
||||
}
|
||||
|
||||
void Binding::startSurface(
|
||||
jint surfaceId,
|
||||
jni::alias_ref<jstring> moduleName,
|
||||
@@ -97,7 +93,7 @@ void Binding::startSurface(
|
||||
initialProps->consume(),
|
||||
{},
|
||||
context,
|
||||
getAnimationDriver());
|
||||
animationDriver_);
|
||||
}
|
||||
|
||||
void Binding::startSurfaceWithConstraints(
|
||||
@@ -144,7 +140,7 @@ void Binding::startSurfaceWithConstraints(
|
||||
initialProps->consume(),
|
||||
constraints,
|
||||
context,
|
||||
getAnimationDriver());
|
||||
animationDriver_);
|
||||
}
|
||||
|
||||
void Binding::renderTemplateToSurface(jint surfaceId, jstring uiTemplate) {
|
||||
@@ -297,9 +293,10 @@ void Binding::installFabricUIManager(
|
||||
toolbox.asynchronousEventBeatFactory = asynchronousBeatFactory;
|
||||
|
||||
if (enableLayoutAnimations_) {
|
||||
animationDriver_ = std::make_unique<LayoutAnimationDriver>(this);
|
||||
animationDriver_ = std::make_shared<LayoutAnimationDriver>(this);
|
||||
}
|
||||
scheduler_ = std::make_shared<Scheduler>(toolbox, getAnimationDriver(), this);
|
||||
scheduler_ = std::make_shared<Scheduler>(
|
||||
toolbox, (animationDriver_ ? animationDriver_.get() : nullptr), this);
|
||||
}
|
||||
|
||||
void Binding::uninstallFabricUIManager() {
|
||||
|
||||
@@ -110,7 +110,7 @@ class Binding : public jni::HybridClass<Binding>,
|
||||
virtual void onAnimationStarted() override;
|
||||
virtual void onAllAnimationsComplete() override;
|
||||
LayoutAnimationDriver *getAnimationDriver();
|
||||
std::unique_ptr<LayoutAnimationDriver> animationDriver_;
|
||||
std::shared_ptr<LayoutAnimationDriver> animationDriver_;
|
||||
|
||||
std::shared_ptr<Scheduler> scheduler_;
|
||||
std::mutex schedulerMutex_;
|
||||
|
||||
Reference in New Issue
Block a user