Title: [209416] trunk/Source/WebCore
Revision
209416
Author
[email protected]
Date
2016-12-06 13:45:00 -0800 (Tue, 06 Dec 2016)

Log Message

DumpRenderTree crashed in com.apple.WebCore: WebCore::MockMediaEndpoint::generateDtlsInfo const + 23
https://bugs.webkit.org/show_bug.cgi?id=165486
<rdar://problem/29149588>

Reviewed by Tim Horton.

The MockMediaEndpoint can be destroyed before the task created in MockMediaEndpoint::generateDtlsInfo()
gets a chance to run, so guard it with a weak pointer.

* platform/mock/MockMediaEndpoint.cpp:
(WebCore::MockMediaEndpoint::MockMediaEndpoint):
(WebCore::MockMediaEndpoint::generateDtlsInfo):
* platform/mock/MockMediaEndpoint.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (209415 => 209416)


--- trunk/Source/WebCore/ChangeLog	2016-12-06 21:40:02 UTC (rev 209415)
+++ trunk/Source/WebCore/ChangeLog	2016-12-06 21:45:00 UTC (rev 209416)
@@ -1,3 +1,19 @@
+2016-12-06  Sam Weinig  <[email protected]>
+
+        DumpRenderTree crashed in com.apple.WebCore: WebCore::MockMediaEndpoint::generateDtlsInfo const + 23
+        https://bugs.webkit.org/show_bug.cgi?id=165486
+        <rdar://problem/29149588>
+
+        Reviewed by Tim Horton.
+
+        The MockMediaEndpoint can be destroyed before the task created in MockMediaEndpoint::generateDtlsInfo()
+        gets a chance to run, so guard it with a weak pointer.
+
+        * platform/mock/MockMediaEndpoint.cpp:
+        (WebCore::MockMediaEndpoint::MockMediaEndpoint):
+        (WebCore::MockMediaEndpoint::generateDtlsInfo):
+        * platform/mock/MockMediaEndpoint.h:
+
 2016-12-06  Chris Dumez  <[email protected]>
 
         Add HTML interactive form validation blacklist for some WebKit-specific sites

Modified: trunk/Source/WebCore/platform/mock/MockMediaEndpoint.cpp (209415 => 209416)


--- trunk/Source/WebCore/platform/mock/MockMediaEndpoint.cpp	2016-12-06 21:40:02 UTC (rev 209415)
+++ trunk/Source/WebCore/platform/mock/MockMediaEndpoint.cpp	2016-12-06 21:45:00 UTC (rev 209416)
@@ -56,6 +56,7 @@
     , m_iceCandidateTimer(*this, &MockMediaEndpoint::iceCandidateTimerFired)
     , m_iceTransportTimer(*this, &MockMediaEndpoint::iceTransportTimerFired)
     , m_unmuteTimer(*this, &MockMediaEndpoint::unmuteTimerFired)
+    , m_weakPtrFactory(this)
 {
 }
 
@@ -71,8 +72,11 @@
 
 void MockMediaEndpoint::generateDtlsInfo()
 {
-    callOnMainThread([this]() {
-        m_client.gotDtlsFingerprint(String(fingerprint), String(fingerprintFunction));
+    auto weakThis = m_weakPtrFactory.createWeakPtr();
+
+    callOnMainThread([weakThis] {
+        if (weakThis)
+            weakThis->m_client.gotDtlsFingerprint(fingerprint, fingerprintFunction);
     });
 }
 

Modified: trunk/Source/WebCore/platform/mock/MockMediaEndpoint.h (209415 => 209416)


--- trunk/Source/WebCore/platform/mock/MockMediaEndpoint.h	2016-12-06 21:40:02 UTC (rev 209415)
+++ trunk/Source/WebCore/platform/mock/MockMediaEndpoint.h	2016-12-06 21:45:00 UTC (rev 209416)
@@ -28,8 +28,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef MockMediaEndpoint_h
-#define MockMediaEndpoint_h
+#pragma once
 
 #if ENABLE(WEB_RTC)
 
@@ -91,10 +90,10 @@
 
     Vector<String> m_midsOfSourcesToUnmute;
     Timer m_unmuteTimer;
+    
+    WeakPtrFactory<MockMediaEndpoint> m_weakPtrFactory;
 };
 
 } // namespace WebCore
 
 #endif // ENABLE(WEB_RTC)
-
-#endif // MockMediaEndpoint_h
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to