Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Explicitly close a document RTCNetworkManager on document teardown
https://bugs.webkit.org/show_bug.cgi?id=247413 rdar://99799545 Reviewed by Eric Carlson. The combination of keeping a WeakPtr of a ThreadSafeRefCounted is problematic, as we might have lost the last Ref/RefPtr (hence the object is scheduled to be deleted) but we still have a non null reference via a WeakPtr, which we could potentially create a new Ref on it. We fix the particular issue here by closing explicitly LibWebRTCNetworkManager which will remove the LibWebRTCNetworkManager from the WebRTCMonitor WeakHashSet. Add ASSERTs to ensure close is called before destroying LibWebRTCNetworkManager. * Source/WebCore/Modules/mediastream/RTCNetworkManager.h: * Source/WebCore/dom/Document.cpp: (WebCore::Document::commonTeardown): * Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetworkManager.cpp: (WebKit::LibWebRTCNetworkManager::getOrCreate): (WebKit::LibWebRTCNetworkManager::LibWebRTCNetworkManager): (WebKit::LibWebRTCNetworkManager::~LibWebRTCNetworkManager): (WebKit::LibWebRTCNetworkManager::close): Canonical link: https://commits.webkit.org/256319@main
- Loading branch information
Showing 4 changed files with 21 additions and 1 deletion.