WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
160879
Add an address-of operator to RetainPtr
https://bugs.webkit.org/show_bug.cgi?id=160879
Summary
Add an address-of operator to RetainPtr
Anders Carlsson
Reported
2016-08-15 16:34:03 PDT
Add an address-of operator to RetainPtr
Attachments
Patch
(75.92 KB, patch)
2016-08-15 16:37 PDT
,
Anders Carlsson
no flags
Details
Formatted Diff
Diff
Patch
(77.75 KB, patch)
2016-08-16 09:43 PDT
,
Anders Carlsson
no flags
Details
Formatted Diff
Diff
Patch
(77.69 KB, patch)
2016-08-16 10:21 PDT
,
Anders Carlsson
thorton
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Anders Carlsson
Comment 1
2016-08-15 16:37:30 PDT
Created
attachment 286117
[details]
Patch
Alex Christensen
Comment 2
2016-08-15 20:50:19 PDT
Comment on
attachment 286117
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=286117&action=review
So if I have a RetainPtr<something> x; and I ever do &x, then x is now null? That's strange.
> Source/WTF/wtf/RetainPtr.h:95 > + CFRelease(ptr);
This isn't tested.
Csaba Osztrogonác
Comment 3
2016-08-15 23:06:30 PDT
Please remove the unrelated xcodeproj file changes.
Darin Adler
Comment 4
2016-08-15 23:28:10 PDT
Comment on
attachment 286117
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=286117&action=review
> Source/WTF/wtf/HashIterators.h:154 > + MappedType* get() const { return std::addressof(m_impl.get()->value); }
Should change this file to use #pragma once.
> Source/WTF/wtf/HashTable.h:851 > + memset(std::addressof(bucket), 0, sizeof(bucket));
Should change this file to use #pragma once.
> Source/WTF/wtf/RetainPtr.h:92 > + PtrType* operator&()
I think this needs a comment explaining what it does.
>> Source/WTF/wtf/RetainPtr.h:95 >> + CFRelease(ptr); > > This isn't tested.
Not sure what you mean exactly.
> Source/WTF/wtf/RetainPtr.h:97 > + return &m_ptr;
Compilation failure on Windows in CookieJarCFNet.cpp: WTF/wtf/RetainPtr.h(97): error C2440: 'return': cannot convert from 'WTF::RetainPtr<CFStringRef>::StorageType *' to 'const __CFString **' (compiling source file WebCore\platform\network\cf\CookieJarCFNet.cpp) WTF/wtf/RetainPtr.h(97): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast (compiling source file WebCore\platform\network\cf\CookieJarCFNet.cpp) WTF/wtf/RetainPtr.h(93): note: while compiling class template member function 'const __CFString **WTF::RetainPtr<CFStringRef>::operator &(void)' (compiling source file WebCore\platform\network\cf\CookieJarCFNet.cpp) WebCore\platform\network\cf\CookieJarCFNet.cpp(145): note: see reference to function template instantiation 'const __CFString **WTF::RetainPtr<CFStringRef>::operator &(void)' being compiled WebCore\platform\network\cf\CookieJarCFNet.cpp(58): note: see reference to class template instantiation 'WTF::RetainPtr<CFStringRef>' being compiled
Anders Carlsson
Comment 5
2016-08-16 09:43:15 PDT
Created
attachment 286181
[details]
Patch
Anders Carlsson
Comment 6
2016-08-16 10:21:34 PDT
Created
attachment 286182
[details]
Patch
Anders Carlsson
Comment 7
2016-08-16 10:28:30 PDT
(In reply to
comment #2
)
> Comment on
attachment 286117
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=286117&action=review
> > So if I have a RetainPtr<something> x; and I ever do &x, then x is now null? > That's strange.
I did it to avoid memory leaks, but I do agree that it's weird and so now I'm just asserting that x is null.
Anders Carlsson
Comment 8
2016-08-16 12:31:12 PDT
Committed
r204519
: <
http://trac.webkit.org/changeset/204519
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug