Cleanup reflection objects for map entry.

pull/2949/head
Feng Xiao 8 years ago
parent 21b0b3ca36
commit ee9c7f17e9
  1. 9
      src/google/protobuf/compiler/cpp/cpp_file.cc
  2. 1
      src/google/protobuf/struct.pb.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");

@ -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() {

Loading…
Cancel
Save