Index: base/json/json_parser.cc |
diff --git a/base/json/json_parser.cc b/base/json/json_parser.cc |
index e85c3d256c4fc1cdd2f59944f5b9c8d270d56593..814b9c42a29fdf24972dbf3085e650cdb571b95a 100644 |
--- a/base/json/json_parser.cc |
+++ b/base/json/json_parser.cc |
@@ -144,6 +144,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); |
@@ -153,6 +159,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; |
+ } |
bool GetAsString(StringPiece* out_value) const override { |
*out_value = string_piece_; |
return true; |