Bug 147793 - Post-review comments on r188146
Summary: Post-review comments on r188146
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-07 14:01 PDT by Myles C. Maxfield
Modified: 2015-08-07 14:55 PDT (History)
5 users (show)

See Also:


Attachments
Patch (10.75 KB, patch)
2015-08-07 14:03 PDT, Myles C. Maxfield
dbates: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2015-08-07 14:01:50 PDT
Post-review comments on r188146
Comment 1 Myles C. Maxfield 2015-08-07 14:03:48 PDT
Created attachment 258526 [details]
Patch
Comment 2 Daniel Bates 2015-08-07 14:39:48 PDT
Comment on attachment 258526 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=258526&action=review

> Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:55
> +        return originalFont;

Take originalFont to be non-null and features to be null. Then this will cause a memory leak because on return from this function the originalFont will have a retain count of 2. Assuming you like the design of having a non void return type for this function, one way to prevent this is to change the data type of originalFont from CTFontRef to RetainPtr<CTFontRef>.

> Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:60
> +        appendTrueTypeFeature(featureArray.get(), (*features)[i]);
> +        appendOpenTypeFeature(featureArray.get(), (*features)[i]);

Is there a better way to write (*features)[i]? One idea is to rename the argument features to featuresPtr and then define a local variable, features, that is constant lvalue reference to FontFeatureSettings after line 55. Then write the remaining code for this function in terms of features.
Comment 3 Daniel Bates 2015-08-07 14:51:26 PDT
(In reply to comment #2)
> Comment on attachment 258526 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=258526&action=review
> 
> > Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:55
> > +        return originalFont;
> 
> [...] Then this will
> cause a memory leak because on return from this function the originalFont
> will have a retain count of 2. 

Disregard this remark. It will not leak. Though it will ref-count churn :/
Comment 4 Myles C. Maxfield 2015-08-07 14:55:33 PDT
Committed r188168: <http://trac.webkit.org/changeset/188168>