Skip to content

Commit e122760

Browse files
javachemeta-codesync[bot]
authored andcommitted
Require constant initialization for Yoga globals
Summary: X-link: react/yoga#2049 Require constant initialization for the layout generation counter and event subscriber list. Changelog: [Internal] ___ landed-with-radar-review Differential Revision: D127576224 fbshipit-source-id: 5eab7b3f7b42d1be6fdf604324f5fbea2b1573a5
1 parent b53ee7f commit e122760

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)