Delete default UnknownFieldSet when shuting down.

pull/458/head
Feng Xiao 10 years ago
parent dbcfc5e202
commit 37df4b65a4
  1. 5
      src/google/protobuf/unknown_field_set.cc

@ -50,8 +50,13 @@ namespace {
// instantiate the UnknownFieldSet dynamically only when required. // instantiate the UnknownFieldSet dynamically only when required.
UnknownFieldSet* default_unknown_field_set_instance_ = NULL; UnknownFieldSet* default_unknown_field_set_instance_ = NULL;
void DeleteDefaultUnknownFieldSet() {
delete default_unknown_field_set_instance_;
}
void InitDefaultUnknownFieldSet() { void InitDefaultUnknownFieldSet() {
default_unknown_field_set_instance_ = new UnknownFieldSet(); default_unknown_field_set_instance_ = new UnknownFieldSet();
internal::OnShutdown(&DeleteDefaultUnknownFieldSet);
} }
GOOGLE_PROTOBUF_DECLARE_ONCE(default_unknown_field_set_once_init_); GOOGLE_PROTOBUF_DECLARE_ONCE(default_unknown_field_set_once_init_);

Loading…
Cancel
Save