Title: [280249] branches/safari-612.1.25-branch/Source/WebKit
Revision
280249
Author
[email protected]
Date
2021-07-23 11:12:32 -0700 (Fri, 23 Jul 2021)

Log Message

Cherry-pick r280183. rdar://problem/81027380

    REGRESSION (r279992): Crashes under RemoteLayerBackingStore::applyBackingStoreToLayer() in macCatalyst
    https://bugs.webkit.org/show_bug.cgi?id=228181
    rdar://80923581

    Reviewed by Dan Bates.

    * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
    (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
    r279992 reorganized this code to determine the contents object and then
    set it on the layer, instead of setting it directly; this means that the
    lifetime of the contents object must be extended.

    Interestingly, the common case (the CAMachPort case), as well as the
    case I was actually adding in r279992 both were safe, because of the use
    of autorelease. (macCatalyst uses IOSurface as layer contents directly,
    without CAMachPort, so uses the one path that r279992 broke).

    It is unnecessary to use autorelease; instead just store the contents
    object in a RetainPtr until it is set.

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

Modified Paths

Diff

Modified: branches/safari-612.1.25-branch/Source/WebKit/ChangeLog (280248 => 280249)


--- branches/safari-612.1.25-branch/Source/WebKit/ChangeLog	2021-07-23 17:47:17 UTC (rev 280248)
+++ branches/safari-612.1.25-branch/Source/WebKit/ChangeLog	2021-07-23 18:12:32 UTC (rev 280249)
@@ -1,3 +1,52 @@
+2021-07-23  Russell Epstein  <[email protected]>
+
+        Cherry-pick r280183. rdar://problem/81027380
+
+    REGRESSION (r279992): Crashes under RemoteLayerBackingStore::applyBackingStoreToLayer() in macCatalyst
+    https://bugs.webkit.org/show_bug.cgi?id=228181
+    rdar://80923581
+    
+    Reviewed by Dan Bates.
+    
+    * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
+    (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
+    r279992 reorganized this code to determine the contents object and then
+    set it on the layer, instead of setting it directly; this means that the
+    lifetime of the contents object must be extended.
+    
+    Interestingly, the common case (the CAMachPort case), as well as the
+    case I was actually adding in r279992 both were safe, because of the use
+    of autorelease. (macCatalyst uses IOSurface as layer contents directly,
+    without CAMachPort, so uses the one path that r279992 broke).
+    
+    It is unnecessary to use autorelease; instead just store the contents
+    object in a RetainPtr until it is set.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280183 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-07-22  Tim Horton  <[email protected]>
+
+            REGRESSION (r279992): Crashes under RemoteLayerBackingStore::applyBackingStoreToLayer() in macCatalyst
+            https://bugs.webkit.org/show_bug.cgi?id=228181
+            rdar://80923581
+
+            Reviewed by Dan Bates.
+
+            * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
+            (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
+            r279992 reorganized this code to determine the contents object and then
+            set it on the layer, instead of setting it directly; this means that the
+            lifetime of the contents object must be extended.
+
+            Interestingly, the common case (the CAMachPort case), as well as the
+            case I was actually adding in r279992 both were safe, because of the use
+            of autorelease. (macCatalyst uses IOSurface as layer contents directly,
+            without CAMachPort, so uses the one path that r279992 broke).
+
+            It is unnecessary to use autorelease; instead just store the contents
+            object in a RetainPtr until it is set.
+
 2021-07-22  Alan Coon  <[email protected]>
 
         Cherry-pick r280205. rdar://problem/80991517

Modified: branches/safari-612.1.25-branch/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm (280248 => 280249)


--- branches/safari-612.1.25-branch/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm	2021-07-23 17:47:17 UTC (rev 280248)
+++ branches/safari-612.1.25-branch/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm	2021-07-23 18:12:32 UTC (rev 280249)
@@ -426,12 +426,12 @@
     ASSERT(m_bufferHandle);
     layer.contentsOpaque = m_isOpaque;
 
-    id contents = nil;
+    RetainPtr<id> contents;
     WTF::switchOn(*m_bufferHandle,
         [&] (ShareableBitmap::Handle& handle) {
             ASSERT(m_type == Type::Bitmap);
             auto bitmap = ShareableBitmap::create(handle);
-            contents = bitmap->makeCGImageCopy().bridgingAutorelease();
+            contents = bitmap->makeCGImageCopy();
         },
         [&] (MachSendRight& machSendRight) {
             ASSERT(m_type == Type::IOSurface);
@@ -442,7 +442,7 @@
                 break;
             }
             case RemoteLayerBackingStore::LayerContentsType::CAMachPort:
-                contents = adoptCF(CAMachPortCreate(machSendRight.leakSendRight())).bridgingAutorelease();
+                contents = adoptCF(CAMachPortCreate(machSendRight.leakSendRight()));
                 break;
             }
         }
@@ -460,12 +460,12 @@
             return;
         [layer setValue:@1 forKeyPath:WKCGDisplayListEnabledKey];
         auto data = ""
-        [(WKCompositingLayer *)layer _setWKContents:contents withDisplayList:data.get()];
+        [(WKCompositingLayer *)layer _setWKContents:contents.get() withDisplayList:data.get()];
         return;
     }
 #endif
 
-    layer.contents = contents;
+    layer.contents = contents.get();
 }
 
 Vector<std::unique_ptr<WebCore::ThreadSafeImageBufferFlusher>> RemoteLayerBackingStore::takePendingFlushers()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to