WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
211160
REGRESSION (
r260407
): Over-release of NSGraphicsContext in WebKit::convertPlatformImageToBitmap()
https://bugs.webkit.org/show_bug.cgi?id=211160
Summary
REGRESSION (r260407): Over-release of NSGraphicsContext in WebKit::convertPla...
David Kilzer (:ddkilzer)
Reported
2020-04-28 19:33:24 PDT
Over-release of NSGraphicsContext in WebKit::convertPlatformImageToBitmap(). Occurred in
r260407
for
Bug 208891
: auto savedContext = adoptNS([NSGraphicsContext currentContext]);
Attachments
Patch v1
(1.83 KB, patch)
2020-04-28 19:34 PDT
,
David Kilzer (:ddkilzer)
darin
: review+
ddkilzer
: commit-queue-
Details
Formatted Diff
Diff
Patch for landing
(1.79 KB, patch)
2020-04-28 20:01 PDT
,
David Kilzer (:ddkilzer)
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
David Kilzer (:ddkilzer)
Comment 1
2020-04-28 19:34:06 PDT
Created
attachment 397917
[details]
Patch v1
David Kilzer (:ddkilzer)
Comment 2
2020-04-28 19:43:35 PDT
Comment on
attachment 397917
[details]
Patch v1 View in context:
https://bugs.webkit.org/attachment.cgi?id=397917&action=review
> Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:408 > - auto savedContext = adoptNS([NSGraphicsContext currentContext]); > + RetainPtr<NSGraphicsContext> savedContext = [NSGraphicsContext currentContext];
Do we have an RAII object to save NSGraphicsContext.currentContext? Seems like it might be useful.
David Kilzer (:ddkilzer)
Comment 3
2020-04-28 19:51:01 PDT
Comment on
attachment 397917
[details]
Patch v1 View in context:
https://bugs.webkit.org/attachment.cgi?id=397917&action=review
>> Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:408 >> + RetainPtr<NSGraphicsContext> savedContext = [NSGraphicsContext currentContext]; > > Do we have an RAII object to save NSGraphicsContext.currentContext? Seems like it might be useful.
Looks like we have this in WebCore, but it's all CG-based: ALLOW_DEPRECATED_DECLARATIONS_BEGIN CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; ALLOW_DEPRECATED_DECLARATIONS_END CGContextStateSaver stateSaver(cgContext); Via drawCellFocusRingWithFrameAtTime() in Source/WebCore/platform/mac/ThemeMac.mm.
Darin Adler
Comment 4
2020-04-28 19:54:11 PDT
Comment on
attachment 397917
[details]
Patch v1 View in context:
https://bugs.webkit.org/attachment.cgi?id=397917&action=review
>>> Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:408 >>> + RetainPtr<NSGraphicsContext> savedContext = [NSGraphicsContext currentContext]; >> >> Do we have an RAII object to save NSGraphicsContext.currentContext? Seems like it might be useful. > > Looks like we have this in WebCore, but it's all CG-based: > > ALLOW_DEPRECATED_DECLARATIONS_BEGIN > CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; > ALLOW_DEPRECATED_DECLARATIONS_END > > CGContextStateSaver stateSaver(cgContext); > > Via drawCellFocusRingWithFrameAtTime() in Source/WebCore/platform/mac/ThemeMac.mm.
Instead of writing out RetainPtr, I suggest you just change the adoptNS() to retainPtr().
David Kilzer (:ddkilzer)
Comment 5
2020-04-28 19:57:48 PDT
Comment on
attachment 397917
[details]
Patch v1 View in context:
https://bugs.webkit.org/attachment.cgi?id=397917&action=review
>>>> Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:408 >>>> + RetainPtr<NSGraphicsContext> savedContext = [NSGraphicsContext currentContext]; >>> >>> Do we have an RAII object to save NSGraphicsContext.currentContext? Seems like it might be useful. >> >> Looks like we have this in WebCore, but it's all CG-based: >> >> ALLOW_DEPRECATED_DECLARATIONS_BEGIN >> CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; >> ALLOW_DEPRECATED_DECLARATIONS_END >> >> CGContextStateSaver stateSaver(cgContext); >> >> Via drawCellFocusRingWithFrameAtTime() in Source/WebCore/platform/mac/ThemeMac.mm. > > Instead of writing out RetainPtr, I suggest you just change the adoptNS() to retainPtr().
Thanks, I had forgotten about that helper.
David Kilzer (:ddkilzer)
Comment 6
2020-04-28 20:01:12 PDT
Created
attachment 397918
[details]
Patch for landing
Tim Horton
Comment 7
2020-04-28 20:11:30 PDT
I think Darin might have been referring to LocalCurrentGraphicsContext?
David Kilzer (:ddkilzer)
Comment 8
2020-04-28 21:09:25 PDT
Comment on
attachment 397918
[details]
Patch for landing Setting cq+ with win bot orange as this code isn't used on Windows.
EWS
Comment 9
2020-04-28 21:26:17 PDT
Committed
r260864
: <
https://trac.webkit.org/changeset/260864
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 397918
[details]
.
Radar WebKit Bug Importer
Comment 10
2020-04-28 21:27:15 PDT
<
rdar://problem/62573162
>
Darin Adler
Comment 11
2020-04-29 11:39:54 PDT
(In reply to Tim Horton from
comment #7
)
> I think Darin might have been referring to LocalCurrentGraphicsContext?
It does seem like LocalCurrentGraphicsContext would be usable here with a tiny bit of refactoring.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug