Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a30d85f9c75ddbab183ac5bb763254da3358a7ca
      
https://github.com/WebKit/WebKit/commit/a30d85f9c75ddbab183ac5bb763254da3358a7ca
  Author: Wenson Hsieh <[email protected]>
  Date:   2026-02-22 (Sun, 22 Feb 2026)

  Changed paths:
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm

  Log Message:
  -----------
  [macOS] Occasional crash when dropping files over `WKWebView` under 
performDragWithLegacyFiles
https://bugs.webkit.org/show_bug.cgi?id=308407
rdar://168947130

Reviewed by Richard Robinson.

This is a speculative fix for a crash here:

```
static void performDragWithLegacyFiles(WebPageProxy& page, 
Box<Vector<String>>&& fileNames, Box<WebCore::DragData>&& dragData, const 
String& pasteboardName)
{
    RefPtr networkProcess = page.websiteDataStore().networkProcessIfExists(); 
// <- - - - - -
    if (!networkProcess)
        return;
```

...due to `page` being null. It's unclear to me exactly why this might be 
happening (since the page
should be strongly `Ref`ed through the `receivePromisedFilesAtDestination` 
reader block and the
subsequent dispatch back onto the main thread), but it seems possible that the 
implicit conversion
from C++ lambda to ObjC block fails to copy the captured variables (i.e. 
failing to ref the page)
when creating the file reader completion block that's called on a background 
queue — if this is the
case, we could fix this by using `makeBlockPtr` to force a `Block_copy` instead 
of relying only on
implicit conversion from lambda to block.

* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::handleLegacyFilesPromisePasteboard):

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



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

Reply via email to