Bug 115389

Summary: It should be an error to use adoptPtr with RefCounted subclasses
Product: WebKit Reporter: Anders Carlsson <andersca>
Component: New BugsAssignee: Anders Carlsson <andersca>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cmarcelo, commit-queue, darin
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch benjamin: review+

Description Anders Carlsson 2013-04-29 17:24:28 PDT
It should be an error to use adoptPtr with RefCounted subclasses
Comment 1 Anders Carlsson 2013-04-29 17:25:10 PDT
Created attachment 200063 [details]
Patch
Comment 2 Benjamin Poulain 2013-04-29 17:34:53 PDT
Comment on attachment 200063 [details]
Patch

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

I loooove this. Great idea.

> Source/WTF/wtf/PassOwnPtr.h:151
> +        COMPILE_ASSERT(!(IsSubclass<T, RefCounted<T> >::value), DoNotUseAdoptPtrWithRefCounted);
> +        COMPILE_ASSERT(!(IsSubclass<T, ThreadSafeRefCounted<T> >::value), DoNotUseAdoptPtrWithThreadSafeRefCounted);

+RefCountedBase
Comment 3 Anders Carlsson 2013-04-29 17:38:58 PDT
(In reply to comment #2)
> (From update of attachment 200063 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=200063&action=review
> 
> I loooove this. Great idea.
> 
> > Source/WTF/wtf/PassOwnPtr.h:151
> > +        COMPILE_ASSERT(!(IsSubclass<T, RefCounted<T> >::value), DoNotUseAdoptPtrWithRefCounted);
> > +        COMPILE_ASSERT(!(IsSubclass<T, ThreadSafeRefCounted<T> >::value), DoNotUseAdoptPtrWithThreadSafeRefCounted);
> 
> +RefCountedBase

I’ll use ThreadSafeRefCountedBase and RefCountedBase instead.
Comment 4 Anders Carlsson 2013-04-29 17:45:18 PDT
Committed r149341: <http://trac.webkit.org/changeset/149341>