Avoid de-referencing possibly gone port when posting tasks. Instead use the network_thread() accessor for accessing the thread pointer. Also including a safety check in OnClose callback as an extra check. Bug: chromium:1316996 Change-Id: I8fa2c7b526a9db953f50bbbabb3e4b2fcef8221a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/263900 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37013}