Fix crash during teardown of PingLoad
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Apr 2019 18:09:02 +0000 (18:09 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Apr 2019 18:09:02 +0000 (18:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197024
<rdar://problem/49973077>

Reviewed by Jer Noble.

* NetworkProcess/PingLoad.cpp:
(WebKit::PingLoad::initialize):
Early return if weakThis is null.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244389 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/PingLoad.cpp

index 155a922..c76762b 100644 (file)
@@ -1,3 +1,15 @@
+2019-04-17  Alex Christensen  <achristensen@webkit.org>
+
+        Fix crash during teardown of PingLoad
+        https://bugs.webkit.org/show_bug.cgi?id=197024
+        <rdar://problem/49973077>
+
+        Reviewed by Jer Noble.
+
+        * NetworkProcess/PingLoad.cpp:
+        (WebKit::PingLoad::initialize):
+        Early return if weakThis is null.
+
 2019-04-17  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         REGRESSION (r243926): [iOS] Release assertion when computing editor state during an overflow scroll triggered by layout
index 4955302..21bc7a4 100644 (file)
@@ -77,7 +77,9 @@ void PingLoad::initialize(NetworkProcess& networkProcess)
     // Set a very generous timeout, just in case.
     m_timeoutTimer.startOneShot(60000_s);
 
-    m_networkLoadChecker->check(ResourceRequest { m_parameters.request }, nullptr, [this, networkProcess = makeRef(networkProcess)] (auto&& result) {
+    m_networkLoadChecker->check(ResourceRequest { m_parameters.request }, nullptr, [this, weakThis = makeWeakPtr(*this), networkProcess = makeRef(networkProcess)] (auto&& result) {
+        if (!weakThis)
+            return;
         WTF::switchOn(result,
             [this] (ResourceError& error) {
                 this->didFinish(error);