Skip to content

Commit 08993ef

Browse files
javachefacebook-github-bot
authored andcommitted
Require constant initialization for Yoga globals
Summary: Require constant initialization for the layout generation counter and event subscriber list. Changelog: [Internal] ___ landed-with-radar-review Differential Revision: D127576224
1 parent 859d9b8 commit 08993ef

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
namespace facebook::yoga {
3737

38-
std::atomic<uint32_t> gCurrentGenerationCount(0);
38+
constinit std::atomic<uint32_t> gCurrentGenerationCount(0);
3939

4040
static bool hasAutoHorizontalMargin(const Style& style) {
4141
for (const auto direction : {Direction::LTR, Direction::RTL}) {

‎packages/react-native/ReactCommon/yoga/yoga/event/event.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct Node {
4646
: subscriber{std::move(subscriber)} {}
4747
};
4848

49-
std::atomic<Node*> subscribers{nullptr};
49+
constinit std::atomic<Node*> subscribers{nullptr};
5050

5151
Node* push(Node* newHead) {
5252
Node* oldHead = nullptr;

0 commit comments

Comments
 (0)