Skip to content

Commit

Permalink
Merge r163460 - HashMap can't be used with std::unique_ptr as value w…
Browse files Browse the repository at this point in the history
…hen it has a custom deleter

https://bugs.webkit.org/show_bug.cgi?id=128250

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2014-02-05
Reviewed by Darin Adler.

The problem is that the HashMap is using a unique_ptr with the
default deleter, so that when trying to move the unique_ptr the
deleters don't match.

* wtf/HashTraits.h: Add the deleter also in the template
definitation of the parent class for the HashTraits<std::unique_ptr<T, Deleter>>
  • Loading branch information
carlosgcampos committed Feb 5, 2014
1 parent 98f6d9d commit 9e4f9f5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions Source/WTF/ChangeLog
@@ -1,3 +1,17 @@
2014-02-05 Carlos Garcia Campos <cgarcia@igalia.com>

HashMap can't be used with std::unique_ptr as value when it has a custom deleter
https://bugs.webkit.org/show_bug.cgi?id=128250

Reviewed by Darin Adler.

The problem is that the HashMap is using a unique_ptr with the
default deleter, so that when trying to move the unique_ptr the
deleters don't match.

* wtf/HashTraits.h: Add the deleter also in the template
definitation of the parent class for the HashTraits<std::unique_ptr<T, Deleter>>

2014-01-29 Csaba Osztrogonác <ossy@webkit.org>

Remove ENABLE(JAVASCRIPT_DEBUGGER) guards
Expand Down
2 changes: 1 addition & 1 deletion Source/WTF/wtf/HashTraits.h
Expand Up @@ -101,7 +101,7 @@ template<typename T> struct SimpleClassHashTraits : GenericHashTraits<T> {
static bool isDeletedValue(const T& value) { return value.isHashTableDeletedValue(); }
};

template<typename T, typename Deleter> struct HashTraits<std::unique_ptr<T, Deleter>> : SimpleClassHashTraits<std::unique_ptr<T>> {
template<typename T, typename Deleter> struct HashTraits<std::unique_ptr<T, Deleter>> : SimpleClassHashTraits<std::unique_ptr<T, Deleter>> {
typedef std::nullptr_t EmptyValueType;
static EmptyValueType emptyValue() { return nullptr; }

Expand Down

0 comments on commit 9e4f9f5

Please sign in to comment.