WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
109864
No easy way to use a RetainPtr as a key in a HashMap using object (rather than pointer) equality
https://bugs.webkit.org/show_bug.cgi?id=109864
Summary
No easy way to use a RetainPtr as a key in a HashMap using object (rather tha...
mitz
Reported
2013-02-14 14:28:04 PST
A HashMap<RetainPtr<NSObject>, ValueType> uses pointer hashing and pointer equality rather than -hash and -isEqual:.
Attachments
Patch
(2.47 KB, patch)
2013-02-14 14:30 PST
,
mitz
sam
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
mitz
Comment 1
2013-02-14 14:30:14 PST
Created
attachment 188429
[details]
Patch
Benjamin Poulain
Comment 2
2013-02-14 14:40:48 PST
View in context:
https://bugs.webkit.org/attachment.cgi?id=188429&action=review
> Source/WTF/wtf/RetainPtr.h:310 > + static void constructDeletedValue(RetainPtr<P>& slot) { new (&slot) RetainPtr<P>(AdoptCF, reinterpret_cast<P *>(-1)); } > + static bool isDeletedValue(const RetainPtr<P>& value) { return value.get() == reinterpret_cast<P *>(-1); }
I would prefer something using an explicit constructor, like we do in RefPtr.
mitz
Comment 3
2013-02-14 14:59:45 PST
(In reply to
comment #2
)
> View in context:
https://bugs.webkit.org/attachment.cgi?id=188429&action=review
> > > Source/WTF/wtf/RetainPtr.h:310 > > + static void constructDeletedValue(RetainPtr<P>& slot) { new (&slot) RetainPtr<P>(AdoptCF, reinterpret_cast<P *>(-1)); } > > + static bool isDeletedValue(const RetainPtr<P>& value) { return value.get() == reinterpret_cast<P *>(-1); } > > I would prefer something using an explicit constructor, like we do in RefPtr.
Done! Fixed in <
http://trac.webkit.org/r142924
>.
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