Crash under WebKit::WebProcessProxy::didBecomeUnresponsive()
https://bugs.webkit.org/show_bug.cgi?id=197883
<rdar://problem/50665984>
Reviewed by Alex Christensen.
Protect |this| in didBecomeUnresponsive() and didExceedCPULimit() since we call client
delegates and those may cause |this| to get destroyed.
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didBecomeUnresponsive):
(WebKit::WebProcessProxy::didExceedCPULimit):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@245298 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog
index 1402774..e99018a 100644
--- a/Source/WebKit/ChangeLog
+++ b/Source/WebKit/ChangeLog
@@ -1,5 +1,20 @@
2019-05-14 Chris Dumez <cdumez@apple.com>
+ Crash under WebKit::WebProcessProxy::didBecomeUnresponsive()
+ https://bugs.webkit.org/show_bug.cgi?id=197883
+ <rdar://problem/50665984>
+
+ Reviewed by Alex Christensen.
+
+ Protect |this| in didBecomeUnresponsive() and didExceedCPULimit() since we call client
+ delegates and those may cause |this| to get destroyed.
+
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::didBecomeUnresponsive):
+ (WebKit::WebProcessProxy::didExceedCPULimit):
+
+2019-05-14 Chris Dumez <cdumez@apple.com>
+
The network process tries to take a process assertion when NetworkProcess::processWillSuspendImminently() is called
https://bugs.webkit.org/show_bug.cgi?id=197888
diff --git a/Source/WebKit/UIProcess/WebProcessProxy.cpp b/Source/WebKit/UIProcess/WebProcessProxy.cpp
index 79c2e5a..5c7ff9e 100644
--- a/Source/WebKit/UIProcess/WebProcessProxy.cpp
+++ b/Source/WebKit/UIProcess/WebProcessProxy.cpp
@@ -713,6 +713,8 @@
void WebProcessProxy::didBecomeUnresponsive()
{
+ auto protectedThis = makeRef(*this);
+
m_isResponsive = NoOrMaybe::No;
auto isResponsiveCallbacks = WTFMove(m_isResponsiveCallbacks);
@@ -1322,6 +1324,8 @@
void WebProcessProxy::didExceedCPULimit()
{
+ auto protectedThis = makeRef(*this);
+
for (auto& page : pages()) {
if (page->isPlayingAudio()) {
RELEASE_LOG(PerformanceLogging, "%p - WebProcessProxy::didExceedCPULimit() WebProcess with pid %d has exceeded the background CPU limit but we are not terminating it because there is audio playing", this, processIdentifier());