Preventive clean-up: ensure RTCPeerConnection stays valid when calling postTask
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Mar 2017 16:35:18 +0000 (16:35 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Mar 2017 16:35:18 +0000 (16:35 +0000)
commit2c8e6500c1faae9847adb1a057cd9f7ef5bb1cdd
tree6f2419c184c88070a65b3b0b5da6ac1bee5c8017
parent920c10e59f7d7942491d99e0ee6fb992b883d4a0
Preventive clean-up: ensure RTCPeerConnection stays valid when calling postTask
https://bugs.webkit.org/show_bug.cgi?id=169661

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-15
Reviewed by Alex Christensen.

Source/WebCore:

Protecting the RTCPeerConnection object when calling postTask since it might get collected between the task post
and task run. Also do not send negotiationNeeded event if RTCPeerConnection is closed (covered by added test).

* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::updateIceGatheringState):
(WebCore::RTCPeerConnection::updateIceConnectionState):
(WebCore::RTCPeerConnection::scheduleNegotiationNeededEvent):

LayoutTests:

* webrtc/negotiatedneeded-event-addStream-expected.txt:
* webrtc/negotiatedneeded-event-addStream.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213982 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/webrtc/negotiatedneeded-event-addStream-expected.txt
LayoutTests/webrtc/negotiatedneeded-event-addStream.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp