-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Null check IOSurfaceRef when creating WebCore::IOSurface from IOSurfaceRef #2767
Conversation
@@ -213,6 +216,8 @@ | |||
: m_colorSpace(colorSpace) | |||
, m_surface(surface) | |||
{ | |||
ASSERT(surface); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible for this assertion to be hit because surface null checked before it can reach this code? If so, an assertion might make more sense in the ::createFromSurface
method so it has the chance to be hit while in a debug build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to say "defense mechanism hey!" but this is a private constructor already. I can remove this then. About asserting vs. returning nullptr
, I like the latter more because createFromImage
below does that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, it looks like DisplayBufferDisplayDelegate
expects createFromSurface
to potentially return a nullptr
so it makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might make sense to assert at the end of DisplayBufferDisplayDelegate::setDisplayBuffer
in order to catch some simple errors, but I am not familiar with this code enough.
bb81ec1
to
ed35a92
Compare
Before landing, please add a more substantial commit message. What’s the reasoning for putting this check inside the function rather than at the call sites? |
ed35a92
to
a2a2b18
Compare
…ceRef https://bugs.webkit.org/show_bug.cgi?id=243241 Reviewed by NOBODY (OOPS!). When creating a WebCore::IOSurface from an IOSurfaceRef, WebCore::IOSurface expects the IOSurfaceRef to be non-null, so it can pull out the dimension and allocation size of the IOSurfaceRef. * Source/WebCore/platform/graphics/cocoa/IOSurface.mm: (WebCore::IOSurface::createFromSurface):
a2a2b18
to
a8fb293
Compare
Superseded by #5785. |
a8fb293