Merge pull request #2949 from xfxyjwf/3.3.x

Cleanup reflection objects for map entry.
This commit is contained in:
Feng Xiao 2017-04-07 11:30:40 -07:00 committed by GitHub
commit e91caa1f19
2 changed files with 10 additions and 0 deletions

View File

@ -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");

View File

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