Skip to content

Use smart pointers in GraphicsContextGLCVCocoa #47237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rwlbuis
Copy link
Contributor

@rwlbuis rwlbuis commented Jun 26, 2025

@rwlbuis rwlbuis self-assigned this Jun 26, 2025
@rwlbuis rwlbuis added the New Bugs Unclassified bugs are placed in this component until the correct component can be determined. label Jun 26, 2025
@rwlbuis rwlbuis force-pushed the eng/Use-smart-pointers-in-GraphicsContextGLCVCocoa branch from 0cf5ddd to c97305d Compare June 27, 2025 09:09
@webkit-ews-buildbot
Copy link
Collaborator

Safer C++ Build #41807 (c97305d)

⚠️ Found 1 fixed file! Please update expectations in Source/[Project]/SaferCPPExpectations by running the following command and update your pull request:

  • Tools/Scripts/update-safer-cpp-expectations -p WebCore --UnretainedCallArgsChecker platform/graphics/cv/GraphicsContextGLCVCocoa.mm

https://bugs.webkit.org/show_bug.cgi?id=295027

Reviewed by NOBODY (OOPS!).

Fix remaining warnings of type [alpha.webkit.UnretainedCallArgsChecker].

* Source/WebCore/platform/graphics/cv/GraphicsContextGLCVCocoa.mm:
(WebCore::transferFunctionFromString):
(WebCore::GraphicsContextGLCVCocoa::copyVideoSampleToTexture):
@rwlbuis rwlbuis force-pushed the eng/Use-smart-pointers-in-GraphicsContextGLCVCocoa branch from c97305d to fe7a6cf Compare June 27, 2025 10:33
@rwlbuis rwlbuis marked this pull request as ready for review June 27, 2025 13:27
@rwlbuis rwlbuis requested a review from rniwa June 27, 2025 13:27
@rwlbuis
Copy link
Contributor Author

rwlbuis commented Jun 27, 2025

@rniwa the changes involving for example kCVImageBufferYCbCrMatrix_ITU_R_709_2 are a bit optional I think, in that likely CFEqual is a trivial function and no smart pointer should be needed. So I mainly include it to be able to remove the entry out of UnretainedCallArgsCheckerExpectations, but if we can do suppression or make the safer-cpp tooling more clever, I am happy to go with a different solution (I am guessing this will come up more since CFEqual is being used a lot).

@@ -182,17 +182,17 @@ static TransferFunctionCV transferFunctionFromString(CFStringRef string)
{
if (!string)
return TransferFunctionCV::Unknown;
if (CFEqual(string, kCVImageBufferYCbCrMatrix_ITU_R_709_2))
if (RetainPtr matrix = kCVImageBufferYCbCrMatrix_ITU_R_709_2; CFEqual(string, matrix.get()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should just fix the static analyzer to treat CFEqual as a trivial function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made an attempt at llvm/llvm-project#146369. Not sure if you are a reviewer. Also feel free to take over if it is way off. The most important thing is to get it fixed, and then I can rebase this PR and it would be a one-liner PR..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Bugs Unclassified bugs are placed in this component until the correct component can be determined.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants