This is quoted from excellent Juri's investigation: https://codereview.qt-project.org/#/c/222780/
and created for book keeping.
Copyrights belong to Juri.
"Current pointers:
- BrowserContextQt has an owning pointer to ResourceContextQt.
- ResourceContextQt has a non-owning pointer to BrowserContextQt.
- ResourceRequestInfoImpl has a non-owning pointer to ResourceContextQt.
Current shutdown behavior:
1. (UI thread) BrowserContextAdapter::~BrowserContextAdapter calls
BrowserContextQt::~BrowserContextQt, which posts a task to the IO thread to
delete the ResourceContextQt. The BrowserContextQt and BrowserContextAdapter
objects are deleted.
2. (IO thread) ResourceContextQt::~ResourceContextQt runs and calls
ResourceDispatcherHostImpl::CancelRequestsForContext. The ResourceContextQt
object is deleted.
Between steps 1 and 2 the ResourceContextQt object will have a pointer to the
already-deleted BrowserContextQt. Since the requests are only canceled in step 2
then the ResourceDispatcherHostImpl may try to use a ResourceRequestInfoImpl
object, which will try to use the ResourceContextQt object, which will try to
use the already deleted BrowserContextQt object. And then we crash.
"