mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Destroy SessionState only after destroying HostAgent
Summary: Changelog: [Internal] Fixes a bug detected by LeakSanitizer: `HostAgent`'s destructor writes to session state, but when the containing `HostTargetSession` is being torn down, the `SessionState` object currently gets destroyed first, resulting in a dangling reference. Reordering the members of `HostTargetSession` results in the correct destruction order. bypass-github-export-checks Reviewed By: robhogan Differential Revision: D54305545 fbshipit-source-id: e91a6f3de5eed327b811524548d01565e26234fa
This commit is contained in:
committed by
Facebook GitHub Bot
parent
7cfd686214
commit
659712b475
@@ -95,8 +95,10 @@ class HostTargetSession {
|
||||
// Owned by this instance, but shared (weakly) with the frontend channel
|
||||
std::shared_ptr<RAIIRemoteConnection> remote_;
|
||||
FrontendChannel frontendChannel_;
|
||||
HostAgent hostAgent_;
|
||||
SessionState state_;
|
||||
|
||||
// NOTE: hostAgent_ has a raw reference to state_ so must be destroyed first.
|
||||
HostAgent hostAgent_;
|
||||
};
|
||||
|
||||
std::shared_ptr<HostTarget> HostTarget::create(
|
||||
|
||||
Reference in New Issue
Block a user