From 778178479626b0e5b4de0701103a1bb0a067702d Mon Sep 17 00:00:00 2001 From: Gerben Stavenga Date: Wed, 2 Aug 2017 18:25:28 -0700 Subject: Add destructors for default instances to the shutdown code. Verified test succeed under draconian heap checker --- src/google/protobuf/compiler/cpp/cpp_message.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/google/protobuf/compiler/cpp/cpp_message.cc') diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc index 79d0c633..abb2e95a 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message.cc @@ -1977,7 +1977,9 @@ GenerateDefaultInstanceAllocator(io::Printer* printer) { // Construct the default instance. We can't call InitAsDefaultInstance() yet // because we need to make sure all default instances that this one might // depend on are constructed first. - printer->Print("_$classname$_default_instance_.DefaultConstruct();\n", + printer->Print("_$classname$_default_instance_.DefaultConstruct();\n" + "::google::protobuf::internal::OnShutdownDestroyMessage(\n" + " &_$classname$_default_instance_);", "classname", classname_); } -- cgit v1.2.3