Bug 139309 - PassRef should deref on destruction if pointee was not moved.
Summary: PassRef should deref on destruction if pointee was not moved.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-05 13:06 PST by Andreas Kling
Modified: 2014-12-05 14:20 PST (History)
7 users (show)

See Also:


Attachments
Patch (6.54 KB, patch)
2014-12-05 13:11 PST, Andreas Kling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kling 2014-12-05 13:06:30 PST
Instead of having PassRef be a footgun, let's just make it deref() the pointee in ~PassRef if the object was not WTF::move()'d.

This will make PassRef usable for all ::create style functions and enable idioms like Foo::create().get().doStuff();
Comment 1 Andreas Kling 2014-12-05 13:11:58 PST
Created attachment 242652 [details]
Patch
Comment 2 Antti Koivisto 2014-12-05 13:15:25 PST
Comment on attachment 242652 [details]
Patch

Seems like a good idea
Comment 3 Andreas Kling 2014-12-05 14:20:16 PST
Comment on attachment 242652 [details]
Patch

Clearing flags on attachment: 242652

Committed r176873: <http://trac.webkit.org/changeset/176873>
Comment 4 Andreas Kling 2014-12-05 14:20:21 PST
All reviewed patches have been landed.  Closing bug.