Bug 103690 - RenderBlock minor clean-up: replace raw pointers with OwnPtrs.
Summary: RenderBlock minor clean-up: replace raw pointers with OwnPtrs.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ilya Tikhonovsky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-29 17:26 PST by Ilya Tikhonovsky
Modified: 2012-11-30 15:23 PST (History)
7 users (show)

See Also:


Attachments
Patch (9.61 KB, patch)
2012-11-29 17:55 PST, Ilya Tikhonovsky
eric: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ilya Tikhonovsky 2012-11-29 17:26:10 PST
I found another place with raw memory management in RenderBlock code.

patch to follow
Comment 1 Ilya Tikhonovsky 2012-11-29 17:55:40 PST
Created attachment 176869 [details]
Patch
Comment 2 Adam Barth 2012-11-30 13:32:41 PST
Comment on attachment 176869 [details]
Patch

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

> Source/WebCore/rendering/RenderBlock.cpp:3183
>          continuations = new ListHashSet<RenderInline*>;
> -        table->set(this, continuations);
> +        table->set(this, adoptPtr(continuations));

Consider merging these lines.  We prefer to call adoptPtr immediately after calling new:

adoptPtr(new Foo(....))
Comment 3 Eric Seidel (no email) 2012-11-30 13:34:26 PST
Comment on attachment 176869 [details]
Patch

This seems reasonable.  A little scary, but reasonable.  I agree with Adam that putting adoptPtr on the same line as new is better.  It might complicate a couple callers as you couldn't use a raw pointer for a local though.
Comment 4 Ilya Tikhonovsky 2012-11-30 15:23:14 PST
Committed r136288: <http://trac.webkit.org/changeset/136288>