Bug 122945 - WebCore::fillWithEmptyClients adopts new empty clients before leaking their pointers
Summary: WebCore::fillWithEmptyClients adopts new empty clients before leaking their p...
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: Zan Dobersek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-17 00:30 PDT by Zan Dobersek
Modified: 2013-10-22 13:15 PDT (History)
4 users (show)

See Also:


Attachments
Patch (2.48 KB, patch)
2013-10-17 00:42 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff
Patch (3.19 KB, patch)
2013-10-22 04:07 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zan Dobersek 2013-10-17 00:30:12 PDT
WebCore::fillWithEmptyClients adopts new empty clients before leaking their pointers
Comment 1 Zan Dobersek 2013-10-17 00:42:38 PDT
Created attachment 214428 [details]
Patch
Comment 2 Anders Carlsson 2013-10-20 12:38:05 PDT
Comment on attachment 214428 [details]
Patch

These should just use NeverDestroyed instead.
Comment 3 Darin Adler 2013-10-20 19:18:06 PDT
(In reply to comment #2)
> These should just use NeverDestroyed instead.

So you prefer NeverDestroyed<unique_ptr<X>> to, say, X& for these kinds of globals?
Comment 4 Zan Dobersek 2013-10-21 08:50:48 PDT
(In reply to comment #3)
> (In reply to comment #2)
> > These should just use NeverDestroyed instead.
> 
> So you prefer NeverDestroyed<unique_ptr<X>> to, say, X& for these kinds of globals?

std::unique_ptr isn't that useful (or required) here.
Comment 5 Darin Adler 2013-10-21 09:45:35 PDT
I believe there is an argument in favor of it that Anders may wish to make. Iā€™d like to hear more from him.
Comment 6 Anders Carlsson 2013-10-21 10:07:15 PDT
(In reply to comment #3)
> (In reply to comment #2)
> > These should just use NeverDestroyed instead.
> 
> So you prefer NeverDestroyed<unique_ptr<X>> to, say, X& for these kinds of globals?

No, just NeverDestroyed<X>.
Comment 7 Darin Adler 2013-10-21 11:01:31 PDT
(In reply to comment #6)
> No, just NeverDestroyed<X>.

Oh, right. Sorry, I guess I overlooked that possibility. Does seem better to avoid the heap memory allocation altogether.
Comment 8 Zan Dobersek 2013-10-22 04:07:31 PDT
Created attachment 214834 [details]
Patch
Comment 9 Zan Dobersek 2013-10-22 13:15:06 PDT
Comment on attachment 214834 [details]
Patch

Clearing flags on attachment: 214834

Committed r157807: <http://trac.webkit.org/changeset/157807>
Comment 10 Zan Dobersek 2013-10-22 13:15:14 PDT
All reviewed patches have been landed.  Closing bug.