Bug 263538 - Make it possible to immediately wrap a retained out param in a smart pointer
Summary: Make it possible to immediately wrap a retained out param in a smart pointer
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-10-23 11:41 PDT by Simon Fraser (smfr)
Modified: 2023-10-23 17:38 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2023-10-23 11:41:30 PDT
We have a lot of code that calls system APIs that return retained pointers like this:

    SecAccessRef accessRef;
    status = SecAccessCreate((__bridge CFStringRef)localizedItemName, nullptr, &accessRef);
    RetainPtr<SecAccessRef> access = adoptCF(accessRef);

This is error prone and makes it hard to write a style checker that finds adoptCF() errors.

We should make it possible to have a smart pointer initialized directly at the point of "&accessRef".
Comment 1 Radar WebKit Bug Importer 2023-10-23 17:35:35 PDT
<rdar://problem/117382839>
Comment 2 Simon Fraser (smfr) 2023-10-23 17:38:26 PDT
Pull request: https://github.com/WebKit/WebKit/pull/19465