Title: [291335] trunk/Source/WebKit
Revision
291335
Author
psaave...@igalia.com
Date
2022-03-16 03:01:09 -0700 (Wed, 16 Mar 2022)

Log Message

[GTK][WPE] Crash during the WebPage::close() related to GL resources destruction
https://bugs.webkit.org/show_bug.cgi?id=237588

Reviewed by Carlos Garcia Campos.

* Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::ThreadedCompositor::invalidate):
(WebKit::ThreadedCompositor::updateSceneWithoutRendering):
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (291334 => 291335)


--- trunk/Source/WebKit/ChangeLog	2022-03-16 07:20:01 UTC (rev 291334)
+++ trunk/Source/WebKit/ChangeLog	2022-03-16 10:01:09 UTC (rev 291335)
@@ -1,3 +1,16 @@
+2022-03-16  Pablo Saavedra  <psaave...@igalia.com>
+
+        [GTK][WPE] Crash during the WebPage::close() related to GL resources destruction
+        https://bugs.webkit.org/show_bug.cgi?id=237588
+
+        Reviewed by Carlos Garcia Campos.
+
+        * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
+        (WebKit::ThreadedCompositor::invalidate):
+        (WebKit::ThreadedCompositor::updateSceneWithoutRendering):
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
+
 2022-03-16  Sihui Liu  <sihui_...@apple.com>
 
         Suspend newly created NetworkStorageManager if network process is or will be suspended

Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h (291334 => 291335)


--- trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h	2022-03-16 07:20:01 UTC (rev 291334)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h	2022-03-16 10:01:09 UTC (rev 291335)
@@ -65,6 +65,7 @@
 
     void applyStateChanges(const Vector<WebCore::CoordinatedGraphicsState>&);
     void paintToCurrentGLContext(const WebCore::TransformationMatrix&, const WebCore::FloatRect&, WebCore::TextureMapper::PaintFlags = 0);
+    void updateSceneState();
     void detach();
 
     // The painting thread must lock the main thread to use below two methods, because two methods access members that the main thread manages. See m_client.
@@ -76,7 +77,6 @@
 
 private:
     void commitSceneState(const WebCore::CoordinatedGraphicsState::NicosiaState&);
-    void updateSceneState();
 
     WebCore::TextureMapperLayer* rootLayer() { return m_rootLayer.get(); }
 

Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp (291334 => 291335)


--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp	2022-03-16 07:20:01 UTC (rev 291334)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp	2022-03-16 10:01:09 UTC (rev 291335)
@@ -106,6 +106,11 @@
     m_compositingRunLoop->performTaskSync([this, protectedThis = Ref { *this }] {
         if (!m_context || !m_context->makeContextCurrent())
             return;
+
+        // Update the scene at this point ensures the layers state are correctly propagated
+        // in the ThreadedCompositor and in the CompositingCoordinator.
+        updateSceneWithoutRendering();
+
         m_scene->purgeGLResources();
         m_context = nullptr;
         m_client.didDestroyGLContext();
@@ -281,6 +286,19 @@
     m_compositingRunLoop->scheduleUpdate();
 }
 
+void ThreadedCompositor::updateSceneWithoutRendering()
+{
+    Vector<WebCore::CoordinatedGraphicsState> states;
+
+    {
+        Locker locker { m_attributes.lock };
+        states = WTFMove(m_attributes.states);
+
+    }
+    m_scene->applyStateChanges(states);
+    m_scene->updateSceneState();
+}
+
 RefPtr<WebCore::DisplayRefreshMonitor> ThreadedCompositor::displayRefreshMonitor(PlatformDisplayID)
 {
     return m_displayRefreshMonitor.copyRef();

Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h (291334 => 291335)


--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h	2022-03-16 07:20:01 UTC (rev 291334)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h	2022-03-16 10:01:09 UTC (rev 291335)
@@ -67,6 +67,7 @@
 
     void updateSceneState(const WebCore::CoordinatedGraphicsState&);
     void updateScene();
+    void updateSceneWithoutRendering();
 
     void invalidate();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to