RESOLVED FIXED 221779
Review usage of adoptNS()
https://bugs.webkit.org/show_bug.cgi?id=221779
Summary Review usage of adoptNS()
Chris Dumez
Reported 2021-02-11 14:06:44 PST
Review usage of adoptNS(): 1. Make sure we call adoptNS() as soon as we allocate the object instead of doing it later on, as this is less error-prone 2. Fix cases where we called adoptNS() but really should have retained instead of adopting
Attachments
Patch (20.77 KB, patch)
2021-02-11 14:08 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2021-02-11 14:08:14 PST
Alex Christensen
Comment 2 2021-02-11 14:14:14 PST
Comment on attachment 420042 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=420042&action=review > Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:510 > [webAnimationDelegate setOwner:this]; If you use [m_delegate setOwner:this] instead, this can only be two lines.
Chris Dumez
Comment 3 2021-02-11 14:16:37 PST
Comment on attachment 420042 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=420042&action=review >> Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:510 >> [webAnimationDelegate setOwner:this]; > > If you use [m_delegate setOwner:this] instead, this can only be two lines. The issue is that the type of m_delegate is NSObject, not WebAnimationDelegate. Maybe that still works in ObjC?
Chris Dumez
Comment 4 2021-02-11 14:20:55 PST
(In reply to Chris Dumez from comment #3) > Comment on attachment 420042 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=420042&action=review > > >> Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:510 > >> [webAnimationDelegate setOwner:this]; > > > > If you use [m_delegate setOwner:this] instead, this can only be two lines. > > The issue is that the type of m_delegate is NSObject, not > WebAnimationDelegate. Maybe that still works in ObjC? As I thought, this does not work: ./platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:510:21: error: 'NSObject' may not respond to 'setOwner:' [-Werror]
EWS
Comment 5 2021-02-11 16:48:52 PST
Committed r272760: <https://commits.webkit.org/r272760> All reviewed patches have been landed. Closing bug and clearing flags on attachment 420042 [details].
Radar WebKit Bug Importer
Comment 6 2021-02-11 16:49:14 PST
Note You need to log in before you can comment on or make changes to this bug.