Summary: | Use BlockPtrs and lambdas instead of new/delete to pass parameters to blocks in WebViewImpl::performDragOperation | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Alex Christensen <achristensen> | ||||
Component: | New Bugs | Assignee: | Alex Christensen <achristensen> | ||||
Status: | REOPENED --- | ||||||
Severity: | Normal | CC: | aestes, bfulgham, commit-queue, webkit-bug-importer | ||||
Priority: | P2 | Keywords: | InRadar | ||||
Version: | WebKit Nightly Build | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Bug Depends on: | 183152 | ||||||
Bug Blocks: | |||||||
Attachments: |
|
Description
Alex Christensen
2017-12-13 19:07:41 PST
Created attachment 329311 [details]
Patch
Comment on attachment 329311 [details]
Patch
Nice! r=me.
Comment on attachment 329311 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=329311&action=review > Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm:3723 > + [item receivePromisedFilesAtDestination:dropLocation.get() options:options operationQueue:queue.get() reader:BlockPtr<void(NSURL *, NSError *)>::fromCallable([this, fileNames = WTFMove(fileNames), fileCount, dragData = WTFMove(dragData), pasteboardName](NSURL * _Nonnull fileURL, NSError * _Nullable errorOrNil) mutable { You can't move fileNames here. The outer lambda that captured fileNames is called multiple times by -enumerateDraggingItems..., and you'll end up moving from the same variable multiple times, which is illegal. > Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm:3729 > + if (fileNames.size() == fileCount) { Because of how fileNames is being moved, this condition will never be true if fileCount is greater than 1. Re-opened since this is blocked by bug 183152 |