aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/proto3_arena_unittest.cc
diff options
context:
space:
mode:
authorGravatar Bo Yang <teboring@google.com>2015-05-21 14:28:59 -0700
committerGravatar Bo Yang <teboring@google.com>2015-05-21 19:32:02 -0700
commit5db217305f37a79eeccd70f000088a06ec82fcec (patch)
treebe53dcf0c0b47ef9178ab8a6fa5c1946ee84a28f /src/google/protobuf/proto3_arena_unittest.cc
parent56095026ccc2f755a6fdb296e30c3ddec8f556a2 (diff)
down-integrate internal changes
Diffstat (limited to 'src/google/protobuf/proto3_arena_unittest.cc')
-rw-r--r--src/google/protobuf/proto3_arena_unittest.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/google/protobuf/proto3_arena_unittest.cc b/src/google/protobuf/proto3_arena_unittest.cc
index c3b5996f..da4be673 100644
--- a/src/google/protobuf/proto3_arena_unittest.cc
+++ b/src/google/protobuf/proto3_arena_unittest.cc
@@ -180,6 +180,16 @@ TEST(ArenaTest, ReleaseMessage) {
EXPECT_EQ(118, nested->bb());
}
+TEST(ArenaTest, MessageFieldClear) {
+ // GitHub issue #310: https://github.com/google/protobuf/issues/310
+ Arena arena;
+ TestAllTypes* arena_message = Arena::CreateMessage<TestAllTypes>(&arena);
+ arena_message->mutable_optional_nested_message()->set_bb(118);
+ // This should not crash, but prior to the bugfix, it tried to use `operator
+ // delete` the nested message (which is on the arena):
+ arena_message->Clear();
+}
+
} // namespace
} // namespace protobuf
} // namespace google