Skip to content

Commit a1b38a7

Browse files
Add weak_ptr to NetworkInformation in SetupNetDetect (#1400)
Co-authored-by: Tom Tan <[email protected]>
1 parent 2fa9ee6 commit a1b38a7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/pal/posix/NetworkInformationImpl.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ virtual NetworkCost GetNetworkCost()
105105
{
106106
if (@available(macOS 10.14, iOS 12.0, *))
107107
{
108+
auto weak_this = std::weak_ptr<NetworkInformation>(shared_from_this());
109+
108110
m_monitor = nw_path_monitor_create();
109111
nw_path_monitor_set_queue(m_monitor, dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0));
110112
nw_path_monitor_set_update_handler(m_monitor, ^(nw_path_t path)

0 commit comments

Comments
 (0)