Bug 114984 - [CSS Exclusions] Improve ExclusionPolygon smart pointer safety
Summary: [CSS Exclusions] Improve ExclusionPolygon smart pointer safety
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Hans Muller
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-22 12:31 PDT by Hans Muller
Modified: 2013-04-23 15:42 PDT (History)
2 users (show)

See Also:


Attachments
Patch (5.02 KB, patch)
2013-04-22 15:46 PDT, Hans Muller
no flags Details | Formatted Diff | Diff
Patch (5.04 KB, patch)
2013-04-22 16:25 PDT, Hans Muller
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hans Muller 2013-04-22 12:31:18 PDT
Eric Seidel pointed out a small stylo and a lack of smart pointer safety in ExclusionPolygon.cpp, here: https://codereview.chromium.org/14220005/.
Comment 1 Hans Muller 2013-04-22 15:46:22 PDT
Created attachment 199121 [details]
Patch

Assign newly allocated objects to PassOwnPtrs as early as possible to reduce the chances of future leaks. No new tests were added, this change adds no new functionality.
Comment 2 WebKit Commit Bot 2013-04-22 15:48:26 PDT
Attachment 199121 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/rendering/ExclusionPolygon.cpp', u'Source/WebCore/rendering/ExclusionShape.cpp']" exit_code: 1
Source/WebCore/rendering/ExclusionPolygon.cpp:140:  Local variables should never be PassOwnPtr (see http://webkit.org/coding/RefPtr.html).  [readability/pass_ptr] [5]
Source/WebCore/rendering/ExclusionPolygon.cpp:161:  Local variables should never be PassOwnPtr (see http://webkit.org/coding/RefPtr.html).  [readability/pass_ptr] [5]
Source/WebCore/rendering/ExclusionShape.cpp:151:  Local variables should never be PassOwnPtr (see http://webkit.org/coding/RefPtr.html).  [readability/pass_ptr] [5]
Total errors found: 3 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Hans Muller 2013-04-22 16:25:11 PDT
Created attachment 199128 [details]
Patch

Use OwnPtr for local variables and explicitly convert them to PassOwnPtr with release().
Comment 4 Dirk Schulze 2013-04-23 15:05:30 PDT
Comment on attachment 199128 [details]
Patch

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

r=me.

> Source/WebCore/rendering/ExclusionShape.cpp:159
> +        exclusionShape = createExclusionPolygon(vertices.release(), polygon->windRule());

I am not necessarily loving it that the vertices are created here and passed from one ctor to the next multiple times, but this particular change seems reasonable.
Comment 5 WebKit Commit Bot 2013-04-23 15:42:13 PDT
Comment on attachment 199128 [details]
Patch

Clearing flags on attachment: 199128

Committed r149003: <http://trac.webkit.org/changeset/149003>
Comment 6 WebKit Commit Bot 2013-04-23 15:42:14 PDT
All reviewed patches have been landed.  Closing bug.