Summary: | Fix false positive leaks when using custom -init methods that don't start with -init | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | David Kilzer (:ddkilzer) <ddkilzer> | ||||
Component: | WebKit Misc. | Assignee: | David Kilzer (:ddkilzer) <ddkilzer> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | joepeck, mitz, webkit-bug-importer | ||||
Priority: | P2 | Keywords: | InRadar | ||||
Version: | WebKit Local Build | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Attachments: |
|
Description
David Kilzer (:ddkilzer)
2018-10-22 21:17:05 PDT
Created attachment 352953 [details]
Patch v1
Comment on attachment 352953 [details] Patch v1 View in context: https://bugs.webkit.org/attachment.cgi?id=352953&action=review > Source/WebKitLegacy/mac/Misc/WebKitErrorsPrivate.h:65 > +- (id)_webkit_initWithDomain:(NSString *)domain code:(int)code URL:(NSURL *)URL __attribute__((objc_method_family(init))); Can you add this declaration to a class extension in the .m file instead of the private @interface in the header file? There’s no reason to expose this internal detail in a header. Comment on attachment 352953 [details] Patch v1 View in context: https://bugs.webkit.org/attachment.cgi?id=352953&action=review >> Source/WebKitLegacy/mac/Misc/WebKitErrorsPrivate.h:65 >> +- (id)_webkit_initWithDomain:(NSString *)domain code:(int)code URL:(NSURL *)URL __attribute__((objc_method_family(init))); > > Can you add this declaration to a class extension in the .m file instead of the private @interface in the header file? There’s no reason to expose this internal detail in a header. Will do. The reason I didn't is that adding this to the WebKitErrors.m file complained about declaring the category twice: @interface NSError (WebKitExtras) - (id)_webkit_initWithDomain:(NSString *)domain code:(int)code URL:(NSURL *)URL __attribute__((objc_method_family(init))); @end I can always do this instead: @interface NSError () - (id)_webkit_initWithDomain:(NSString *)domain code:(int)code URL:(NSURL *)URL __attribute__((objc_method_family(init))); @end But my OCD didn't want to leave the method implemented inside: @implementation NSError (WebKitExtras) @end I guess I'll just add a separate implementation category. Committed r237365: <https://trac.webkit.org/changeset/237365> |