Skip to content

Commit 8bce9c5

Browse files
sherginfacebook-github-bot
authored andcommitted
Fabric: Assert on destruction non-empty of ShadowTreeRegistry
Summary: Destruction of Scheduler (and ShadowTreeRegistry as part of it) which has some running Surfaces is not a good thing and practically a bug on the application layer. With this assert we throw early to flag the issue. Changelog: [Internal] - Dev only assert indicating a broken invariant in ShadowTreeRegistry Reviewed By: sammy-SC Differential Revision: D17924491 fbshipit-source-id: 6b7433fe47630e993e7d5b969f3113f96124b6c9
1 parent e7ef992 commit 8bce9c5

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

ReactCommon/fabric/mounting/ShadowTreeRegistry.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
namespace facebook {
99
namespace react {
1010

11+
ShadowTreeRegistry::~ShadowTreeRegistry() {
12+
assert(registry_.size() == 0 && "Deallocation of non-empty `ShadowTreeRegistry`.");
13+
}
14+
1115
void ShadowTreeRegistry::add(std::unique_ptr<ShadowTree> &&shadowTree) const {
1216
std::unique_lock<better::shared_mutex> lock(mutex_);
1317

ReactCommon/fabric/mounting/ShadowTreeRegistry.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ namespace react {
1919
class ShadowTreeRegistry final {
2020
public:
2121
ShadowTreeRegistry() = default;
22+
~ShadowTreeRegistry();
2223

2324
/*
2425
* Adds a `ShadowTree` instance to the registry.

0 commit comments

Comments
 (0)