Title: [291479] releases/WebKitGTK/webkit-2.36/Source/WebKit
Revision
291479
Author
carlo...@webkit.org
Date
2022-03-18 05:59:28 -0700 (Fri, 18 Mar 2022)

Log Message

Merge r291475 - [WPE][GTK] Fix a crash after r290360
https://bugs.webkit.org/show_bug.cgi?id=237917

Reviewed by Youenn Fablet.

When AuxiliaryProcess::shutDown is called for the WebProcess there might be pages not closed yet, for example
when swapping process on navigation, the close message is sent to the page after the shutdown. In the case of
GTK and WPE ports the pages are closed before stopping the run loop to ensure associated resources (like GPU
resources) are released. Closing the last page makes the process termination allowed, which ends up calling
AuxiliaryProcess::terminate again. Also, when the shutdown message is received we don't want to ask again the UI
process whether the process can be terminated, since the UI process asked it.

* Shared/AuxiliaryProcess.cpp:
(WebKit::AuxiliaryProcess::enableTermination): Return early if m_isInShutDown is true.
(WebKit::AuxiliaryProcess::shutDown): Set m_isInShutDown for the scope.
* Shared/AuxiliaryProcess.h:

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.36/Source/WebKit/ChangeLog (291478 => 291479)


--- releases/WebKitGTK/webkit-2.36/Source/WebKit/ChangeLog	2022-03-18 12:59:24 UTC (rev 291478)
+++ releases/WebKitGTK/webkit-2.36/Source/WebKit/ChangeLog	2022-03-18 12:59:28 UTC (rev 291479)
@@ -1,5 +1,24 @@
 2022-03-18  Carlos Garcia Campos  <cgar...@igalia.com>
 
+        [WPE][GTK] Fix a crash after r290360
+        https://bugs.webkit.org/show_bug.cgi?id=237917
+
+        Reviewed by Youenn Fablet.
+
+        When AuxiliaryProcess::shutDown is called for the WebProcess there might be pages not closed yet, for example
+        when swapping process on navigation, the close message is sent to the page after the shutdown. In the case of
+        GTK and WPE ports the pages are closed before stopping the run loop to ensure associated resources (like GPU
+        resources) are released. Closing the last page makes the process termination allowed, which ends up calling
+        AuxiliaryProcess::terminate again. Also, when the shutdown message is received we don't want to ask again the UI
+        process whether the process can be terminated, since the UI process asked it.
+
+        * Shared/AuxiliaryProcess.cpp:
+        (WebKit::AuxiliaryProcess::enableTermination): Return early if m_isInShutDown is true.
+        (WebKit::AuxiliaryProcess::shutDown): Set m_isInShutDown for the scope.
+        * Shared/AuxiliaryProcess.h:
+
+2022-03-18  Carlos Garcia Campos  <cgar...@igalia.com>
+
         Remove AuxiliaryProcess termination timeout
         https://bugs.webkit.org/show_bug.cgi?id=238012
 

Modified: releases/WebKitGTK/webkit-2.36/Source/WebKit/Shared/AuxiliaryProcess.cpp (291478 => 291479)


--- releases/WebKitGTK/webkit-2.36/Source/WebKit/Shared/AuxiliaryProcess.cpp	2022-03-18 12:59:24 UTC (rev 291478)
+++ releases/WebKitGTK/webkit-2.36/Source/WebKit/Shared/AuxiliaryProcess.cpp	2022-03-18 12:59:28 UTC (rev 291479)
@@ -35,6 +35,7 @@
 #include <WebCore/LogInitialization.h>
 #include <pal/SessionID.h>
 #include <wtf/LogInitialization.h>
+#include <wtf/SetForScope.h>
 
 #if !OS(WINDOWS)
 #include <unistd.h>
@@ -161,7 +162,7 @@
     ASSERT(m_terminationCounter > 0);
     m_terminationCounter--;
 
-    if (m_terminationCounter)
+    if (m_terminationCounter || m_isInShutDown)
         return;
 
     if (shouldTerminate())
@@ -204,6 +205,7 @@
 
 void AuxiliaryProcess::shutDown()
 {
+    SetForScope<bool> isInShutDown(m_isInShutDown, true);
     terminate();
 }
 

Modified: releases/WebKitGTK/webkit-2.36/Source/WebKit/Shared/AuxiliaryProcess.h (291478 => 291479)


--- releases/WebKitGTK/webkit-2.36/Source/WebKit/Shared/AuxiliaryProcess.h	2022-03-18 12:59:24 UTC (rev 291478)
+++ releases/WebKitGTK/webkit-2.36/Source/WebKit/Shared/AuxiliaryProcess.h	2022-03-18 12:59:28 UTC (rev 291479)
@@ -166,6 +166,8 @@
     // A termination counter; when the counter reaches zero, the process will be terminated.
     unsigned m_terminationCounter;
 
+    bool m_isInShutDown { false };
+
     RefPtr<IPC::Connection> m_connection;
     IPC::MessageReceiverMap m_messageReceiverMap;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to