[webkit-changes] [WebKit/WebKit] b7292a: [Materials] Crash when removing hosted materials

Aditya Keerthi noreply at github.com
Thu Feb 27 08:42:33 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b7292a414ad04198b1fc58a6edf19dab9f0c5d02
      https://github.com/WebKit/WebKit/commit/b7292a414ad04198b1fc58a6edf19dab9f0c5d02
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2025-02-27 (Thu, 27 Feb 2025)

  Changed paths:
    M Source/WebKit/Platform/cocoa/WKMaterialHostingSupport.h
    M Source/WebKit/Platform/cocoa/WKMaterialHostingSupport.swift
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm

  Log Message:
  -----------
  [Materials] Crash when removing hosted materials
https://bugs.webkit.org/show_bug.cgi?id=288708
rdar://145703767

Reviewed by Abrar Rahman Protyasha and Tim Horton.

Objects created in Swift and bridged to Objective-C, do not have a +1 retain
count even though the method name contains "create". The use of `adoptNS` with
these objects results in nothing keeping them alive during a commit after the
layers are removed. Consequently, a crash is encountered as CA attempts to use
the layer after it is freed.

Rename methods to remove "create" to reflect the reality of the situation, and
remove the use of `adoptNS` with the bridged methods.

Note that methods that begin with "alloc", "new", "copy", or "mutableCopy"
return a +1 object. A function name that begins with "Create" will also return
+1, but no such rule for methods that begin with "create".

* Source/WebKit/Platform/cocoa/WKMaterialHostingSupport.h:
* Source/WebKit/Platform/cocoa/WKMaterialHostingSupport.swift:
(WKMaterialHostingSupport.isMaterialHostingAvailable):
(WKMaterialHostingSupport.contentLayer(forMaterialHostingLayer:)):
(WKMaterialHostingSupport.createHostingLayer): Deleted.
(WKMaterialHostingSupport.createHostingView(_:)): Deleted.
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::makeNode):
* Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
(-[WKMaterialHostingView init]):

Canonical link: https://commits.webkit.org/291228@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list