Tommi ccc9d979a5 Add checks for a null msg_queue_ to VirtualSocketServer.
The Thread class internally (`Thread::DoDestroy`) makes this call:
  ss_->SetMessageQueue(nullptr);

Which sets the `msg_queue_` member variable of VirtualSocketServer
to nullptr. VSS checks for this in several places, but not all. In
particular `CancelConnects()` does handle it, but Disconnect(), which
is called from the same place (VirtualSocket::Close()), is missing
this check.

This CL adds some DCHECKs to catch when a pointer might be nullptr
and also avoids dereferencing a potential nullptr deref during teardown
if `Disconnect` is called, e.g. from within `VirtualSocket::Close()`
which is called from the dtor of `VirtualSocket`.

Bug: webrtc:13864
Change-Id: I717a0f033ebf70b1f59338680957723a77ccf4ca
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256600
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36312}
2022-03-24 08:18:43 +00:00
..
2021-11-16 10:30:30 +00:00
2022-01-11 14:12:54 +00:00
2021-09-21 16:28:38 +00:00
2021-09-21 16:28:38 +00:00
2022-01-28 15:13:45 +00:00
2021-08-31 14:27:49 +00:00
2019-11-26 14:05:20 +00:00
2021-04-22 13:04:53 +00:00
2021-04-16 08:47:17 +00:00
2021-09-21 15:17:26 +00:00
2021-01-29 08:24:43 +00:00
2022-01-25 15:39:53 +00:00
2021-02-10 15:04:55 +00:00
2021-10-13 19:26:10 +00:00