diff options
author | Gerben Stavenga <gerbens@google.com> | 2017-08-02 18:25:28 -0700 |
---|---|---|
committer | Gerben Stavenga <gerbens@google.com> | 2017-08-02 18:25:28 -0700 |
commit | 778178479626b0e5b4de0701103a1bb0a067702d (patch) | |
tree | 2c80366a7fe6389b33764b5895e24d1bb6435971 /src/google/protobuf/type.pb.cc | |
parent | 53ae6de18b51509e67ec84bd6363985d14750bd7 (diff) |
Add destructors for default instances to the shutdown code.
Verified test succeed under draconian heap checker
Diffstat (limited to 'src/google/protobuf/type.pb.cc')
-rw-r--r-- | src/google/protobuf/type.pb.cc | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index 56f06edb..b9cc7a93 100644 --- a/src/google/protobuf/type.pb.cc +++ b/src/google/protobuf/type.pb.cc @@ -156,11 +156,16 @@ void TableStruct::InitDefaultsImpl() { ::google::protobuf::protobuf_google_2fprotobuf_2fany_2eproto::InitDefaults(); ::google::protobuf::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::InitDefaults(); _Type_default_instance_.DefaultConstruct(); - _Field_default_instance_.DefaultConstruct(); - _Enum_default_instance_.DefaultConstruct(); - _EnumValue_default_instance_.DefaultConstruct(); - _Option_default_instance_.DefaultConstruct(); - _Type_default_instance_.get_mutable()->source_context_ = const_cast< ::google::protobuf::SourceContext*>( + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_Type_default_instance_);_Field_default_instance_.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_Field_default_instance_);_Enum_default_instance_.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_Enum_default_instance_);_EnumValue_default_instance_.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_EnumValue_default_instance_);_Option_default_instance_.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_Option_default_instance_);_Type_default_instance_.get_mutable()->source_context_ = const_cast< ::google::protobuf::SourceContext*>( ::google::protobuf::SourceContext::internal_default_instance()); _Enum_default_instance_.get_mutable()->source_context_ = const_cast< ::google::protobuf::SourceContext*>( ::google::protobuf::SourceContext::internal_default_instance()); @@ -440,7 +445,7 @@ void Type::SharedDtor() { } name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); - delete source_context_; + if (this != internal_default_instance()) delete source_context_; } void Type::ArenaDtor(void* object) { @@ -2353,7 +2358,7 @@ void Enum::SharedDtor() { } name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); - delete source_context_; + if (this != internal_default_instance()) delete source_context_; } void Enum::ArenaDtor(void* object) { @@ -3535,7 +3540,7 @@ void Option::SharedDtor() { } name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); - delete value_; + if (this != internal_default_instance()) delete value_; } void Option::ArenaDtor(void* object) { |