Closed
Bug 1251530
Opened 10 years ago
Closed 10 years ago
Use 'MakeUnique' instead of 'new' to populate UniquePtr variable in AddCSSValuePair
Categories
(Core :: CSS Parsing and Computation, defect)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla47
| Tracking | Status | |
|---|---|---|
| firefox47 | --- | fixed |
People
(Reporter: dholbert, Assigned: dholbert)
References
Details
Attachments
(1 file)
|
1.24 KB,
patch
|
jwatt
:
review+
|
Details | Diff | Splinter Review |
Just noticed a UniquePtr anti-pattern that I let slip through in review (but should've caught) in bug 1110460 part 3.
The UniquePtr header says:
> 619 * UniquePtr<char> p;
> 620 * p = new char; // ERROR
> 621 * p.reset(new char); // works, but fugly
> 622 * p = MakeUnique<char>(); // preferred
http://mxr.mozilla.org/mozilla-central/source/mfbt/UniquePtr.h#619
...with more details about why MakeUnique() is preferred.
We added a "fugly" line here:
http://hg.mozilla.org/mozilla-central/diff/64a6ad689503/layout/style/StyleAnimationValue.cpp#l1.49
Filing this bug on replacing it with MakeUnique.
| Assignee | ||
Updated•10 years ago
|
Summary: Use MakeUnique for UniquePtr assignment, in AddCSSValuePair → Use 'MakeUnique' instead of 'new' to populate UniquePtr variable in AddCSSValuePair
| Assignee | ||
Comment 1•10 years ago
|
||
Here's the fix, just following the recommendation quoted in comment 0.
Attachment #8723950 -
Flags: review?(jwatt)
Comment 2•10 years ago
|
||
Comment on attachment 8723950 [details] [diff] [review]
fix
Good catch!
Attachment #8723950 -
Flags: review?(jwatt) → review+
| Assignee | ||
Updated•10 years ago
|
Flags: in-testsuite-
Comment 4•10 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
You need to log in
before you can comment on or make changes to this bug.
Description
•