Skip to content

Commit d06a7c1

Browse files
sammy-SCfacebook-github-bot
authored andcommitted
Erase ComponentDescriptorRegistry before inserting it to fix crash
Summary: Changelog: [internal] if you called `ContextContainer.insert("key", <value>)` and then again `ContextContainer.insert("key", <new_value>)`, the old value will remain in `ContextContainer`. This seems to be by design however it causes crash when reloading surface that uses `ComponentDescriptorRegistry_DO_NOT_USE_PRETTY_PLEASE`. We fix it by erasing `ComponentDescriptorRegistry_DO_NOT_USE_PRETTY_PLEASE` in Scheduler before inserting a new one. Reviewed By: shergin Differential Revision: D18421153 fbshipit-source-id: a01e5f6ac864fd641674d84e97d447f8cb9114be
1 parent 620f83a commit d06a7c1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ReactCommon/fabric/uimanager/Scheduler.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,11 @@ Scheduler::Scheduler(
7272
uiManagerBinding->attach(uiManager);
7373
});
7474

75+
auto componentDescriptorRegistryKey =
76+
"ComponentDescriptorRegistry_DO_NOT_USE_PRETTY_PLEASE";
77+
schedulerToolbox.contextContainer->erase(componentDescriptorRegistryKey);
7578
schedulerToolbox.contextContainer->insert(
76-
"ComponentDescriptorRegistry_DO_NOT_USE_PRETTY_PLEASE",
79+
componentDescriptorRegistryKey,
7780
std::weak_ptr<ComponentDescriptorRegistry const>(
7881
componentDescriptorRegistry_));
7982

0 commit comments

Comments
 (0)