Commit Graph

3 Commits

Author SHA1 Message Date
Samuel Susla 60c15073bf Fix crash in state reconciliation
Summary:
Changelog: [internal]

Repro steps:

1. Go to fbsource/fbobjc.
2. Run following focus command P124860753.
3. Enable Address Sanitizer in Xcode.
3. Run the app from Xcode.
5. Make sure `react_fabric.enable_marketplace_home_ios` and `react_fabric.enabled_state_reconciliation_ios` Mobile Config flags are set to true.
6. Navigate to Marketplace Home and observe use of freed memory exception. You have to wait until second page of marketplace home feed is loaded.

{F228880980}

# Root cause

`ChangedShadowNodePairs` being a vector of pairs of references.
Those `shared_ptr` do not outlive the the run of `reconcileStateWithTree` (that's what I originally thought when I made them references).

This was introduced in D19814500.

Reviewed By: JoshuaGross

Differential Revision: D19977784

fbshipit-source-id: 8c4a381137baa08a6af9d3c1cb295fe6c2b2bf95
2020-02-19 14:31:22 -08:00
Samuel Susla acdaf512e5 Apply small style adjustments to reconcileStateWithTree
Summary:
Changelog: [Internal]

There shouldn't be any logical changes to the code.

Reviewed By: JoshuaGross

Differential Revision: D19814500

fbshipit-source-id: 2be492eebb284c7e241662d9d78117badcb2eee4
2020-02-10 15:35:36 -08:00
Joshua Gross 27981ad991 Core: Add "state reconciliation" to commit phase, pre-layout
Summary:
This implements proposal #2 in our State architecture doc: https://fb.quip.com/bm2EAVwL7jQ5

Problem description: see the text in the comment of TreeStateReconciliation.h

Solution: see also comments in TreeStateReconciliation.h.

Changelog: [internal]

Reviewed By: mdvacca

Differential Revision: D19617329

fbshipit-source-id: 845fb5fe27f2591be433b6d77799707b3516fb1a
2020-02-08 11:33:43 -08:00