Add an address-of operator to RetainPtr
Created attachment 286117 [details] Patch
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.
Please remove the unrelated xcodeproj file changes.
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
Created attachment 286181 [details] Patch
Created attachment 286182 [details] Patch
(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.
Committed r204519: <http://trac.webkit.org/changeset/204519>