WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
155395
[iOS] WKPreviewAction conforms to NSCopying but doesn’t override -copyWithZone:
https://bugs.webkit.org/show_bug.cgi?id=155395
Summary
[iOS] WKPreviewAction conforms to NSCopying but doesn’t override -copyWithZone:
mitz
Reported
2016-03-12 12:04:50 PST
_WKPreviewAction (which should be renamed WKPreviewAction) is a subclass of UIPreviewAction, and therefore conforms to NSCopying. It needs to override -copyWithZone: so that when it’s copied, the the copy has the same identifier.
Attachments
Patch
(1.28 KB, patch)
2016-03-14 13:31 PDT
,
Beth Dakin
mitz: review-
Details
Formatted Diff
Diff
Patch
(1.25 KB, patch)
2016-03-14 13:38 PDT
,
Beth Dakin
no flags
Details
Formatted Diff
Diff
Patch
(1.26 KB, patch)
2016-03-14 13:49 PDT
,
Beth Dakin
no flags
Details
Formatted Diff
Diff
Patch
(1.25 KB, patch)
2016-03-14 14:01 PDT
,
Beth Dakin
sam
: review+
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2016-03-14 13:30:15 PDT
<
rdar://problem/25150528
>
Beth Dakin
Comment 2
2016-03-14 13:31:43 PDT
Created
attachment 274011
[details]
Patch
mitz
Comment 3
2016-03-14 13:33:58 PDT
Comment on
attachment 274011
[details]
Patch This makes a copy that doesn’t have the original’s title, style and handler!
Beth Dakin
Comment 4
2016-03-14 13:38:16 PDT
Created
attachment 274016
[details]
Patch
mitz
Comment 5
2016-03-14 13:40:31 PDT
Comment on
attachment 274016
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=274016&action=review
> Source/WebKit2/UIProcess/API/Cocoa/WKPreviewActionItem.mm:43 > + WKPreviewAction *action = [self copyWithZone:zone];
This looks infinitely recursive.
Beth Dakin
Comment 6
2016-03-14 13:42:40 PDT
(In reply to
comment #5
)
> Comment on
attachment 274016
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=274016&action=review
> > > Source/WebKit2/UIProcess/API/Cocoa/WKPreviewActionItem.mm:43 > > + WKPreviewAction *action = [self copyWithZone:zone]; > > This looks infinitely recursive.
Eep! It does.
Beth Dakin
Comment 7
2016-03-14 13:49:31 PDT
Created
attachment 274021
[details]
Patch
Beth Dakin
Comment 8
2016-03-14 14:01:15 PDT
Created
attachment 274024
[details]
Patch
Sam Weinig
Comment 9
2016-03-14 15:51:57 PDT
Comment on
attachment 274024
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=274024&action=review
You should remove the explicit conformance to NSCopying of WKPreviewAction since UIPreviewAction already conforms to it.
> Source/WebKit2/UIProcess/API/Cocoa/WKPreviewActionItem.mm:45 > + WKPreviewAction *action = [super copyWithZone:zone]; > + action->_identifier = self.identifier; > + return action;
Since WKPreviewAction is immutable, this can be implemented as: return [self retain];
Sam Weinig
Comment 10
2016-03-14 15:55:24 PDT
(In reply to
comment #9
)
> Comment on
attachment 274024
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=274024&action=review
> > You should remove the explicit conformance to NSCopying of WKPreviewAction > since UIPreviewAction already conforms to it. > > > Source/WebKit2/UIProcess/API/Cocoa/WKPreviewActionItem.mm:45 > > + WKPreviewAction *action = [super copyWithZone:zone]; > > + action->_identifier = self.identifier; > > + return action; > > Since WKPreviewAction is immutable, this can be implemented as: > > return [self retain];
Actually, it looks like it isn't completely immutable, so you should do your thing.
Beth Dakin
Comment 11
2016-03-14 15:58:51 PDT
Thanks Sam and Dan!
http://trac.webkit.org/changeset/198166
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