Index: base/json/json_parser.cc |
diff --git a/base/json/json_parser.cc b/base/json/json_parser.cc |
index 1850a1a3f66e2dc4814235c75d3b8190bef794f9..71de23033be0e5cc61fa6dfbd6bd97e09ec2ef0d 100644 |
--- a/base/json/json_parser.cc |
+++ b/base/json/json_parser.cc |
@@ -142,6 +142,12 @@ class JSONStringValue : public Value { |
explicit JSONStringValue(StringPiece piece) |
: Value(Type::STRING), string_piece_(piece) {} |
+ ~JSONStringValue() override { |
+ // Ugly hack that prevents ~Value() from trying to destroy string_value_. |
+ // TODO(crbug.com/646113): Clean this up when StringValue will be removed. |
+ type_ = Type::NONE; |
+ } |
+ |
// Overridden from Value: |
bool GetAsString(std::string* out_value) const override { |
string_piece_.CopyToString(out_value); |
@@ -151,6 +157,12 @@ class JSONStringValue : public Value { |
*out_value = UTF8ToUTF16(string_piece_); |
return true; |
} |
+ // base::Value::GetAsString contains a proper implementation now, so the old |
+ // behavior is copied here. |
+ // TODO(crbug.com/646113): Clean this up when StringValue will be removed. |
+ bool GetAsString(const StringValue** out_value) const override { |
+ return false; |
+ } |
Value* DeepCopy() const override { return new StringValue(string_piece_); } |
bool Equals(const Value* other) const override { |
std::string other_string; |