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/api.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/api.pb.cc')
-rw-r--r-- | src/google/protobuf/api.pb.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc index dfbee724..903fd93b 100644 --- a/src/google/protobuf/api.pb.cc +++ b/src/google/protobuf/api.pb.cc @@ -125,9 +125,12 @@ void TableStruct::InitDefaultsImpl() { ::google::protobuf::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::InitDefaults(); ::google::protobuf::protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaults(); _Api_default_instance_.DefaultConstruct(); - _Method_default_instance_.DefaultConstruct(); - _Mixin_default_instance_.DefaultConstruct(); - _Api_default_instance_.get_mutable()->source_context_ = const_cast< ::google::protobuf::SourceContext*>( + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_Api_default_instance_);_Method_default_instance_.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_Method_default_instance_);_Mixin_default_instance_.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_Mixin_default_instance_);_Api_default_instance_.get_mutable()->source_context_ = const_cast< ::google::protobuf::SourceContext*>( ::google::protobuf::SourceContext::internal_default_instance()); } @@ -244,7 +247,7 @@ Api::~Api() { void Api::SharedDtor() { name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); version_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - delete source_context_; + if (this != internal_default_instance()) delete source_context_; } void Api::SetCachedSize(int size) const { |