aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeng Xiao <xfxyjwf@gmail.com>2017-04-07 11:30:40 -0700
committerGitHub <noreply@github.com>2017-04-07 11:30:40 -0700
commite91caa1f197ec1bd48a713c435c47e6f3948a1fb (patch)
tree10f14f7dc9632c66d249b9bee9438fcdf77c6bc5
parent18c13c93de135e7f1bcde10a29dda116950f49d5 (diff)
parentee9c7f17e953243943181bcbc84590118be6b3c6 (diff)
downloadprotobuf-e91caa1f197ec1bd48a713c435c47e6f3948a1fb.tar.gz
protobuf-e91caa1f197ec1bd48a713c435c47e6f3948a1fb.tar.bz2
protobuf-e91caa1f197ec1bd48a713c435c47e6f3948a1fb.zip
Merge pull request #2949 from xfxyjwf/3.3.x
Cleanup reflection objects for map entry.
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_file.cc9
-rw-r--r--src/google/protobuf/struct.pb.cc1
2 files changed, 10 insertions, 0 deletions
diff --git a/src/google/protobuf/compiler/cpp/cpp_file.cc b/src/google/protobuf/compiler/cpp/cpp_file.cc
index 83e68c12..e0542ae8 100644
--- a/src/google/protobuf/compiler/cpp/cpp_file.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_file.cc
@@ -751,6 +751,15 @@ void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) {
message_generators_[i]->GenerateShutdownCode(printer);
}
+ if (HasDescriptorMethods(file_, options_)) {
+ for (int i = 0; i < message_generators_.size(); i++) {
+ if (!IsMapEntryMessage(message_generators_[i]->descriptor_)) continue;
+ printer->Print(
+ "delete file_level_metadata[$index$].reflection;\n",
+ "index", SimpleItoa(i));
+ }
+ }
+
printer->Outdent();
printer->Print(
"}\n\n");
diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc
index 825810b1..207e9efe 100644
--- a/src/google/protobuf/struct.pb.cc
+++ b/src/google/protobuf/struct.pb.cc
@@ -133,6 +133,7 @@ void TableStruct::Shutdown() {
delete file_level_metadata[2].reflection;
_ListValue_default_instance_.Shutdown();
delete file_level_metadata[3].reflection;
+ delete file_level_metadata[0].reflection;
}
void TableStruct::InitDefaultsImpl() {