aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/generated_message_util.h
diff options
context:
space:
mode:
authorGravatar Jisi Liu <jisi.liu@gmail.com>2016-09-23 11:17:00 -0700
committerGravatar Bo Yang <teboring@google.com>2016-10-10 11:44:21 -0700
commit4cf072248fc39d1c63dcb1600ff9e73df8757779 (patch)
tree0eff71b46678e988703a06e96d3a00681debd453 /src/google/protobuf/generated_message_util.h
parentf9f3c35eb36b208d99a85a21c05767dfd36f2968 (diff)
Fix default instance destructor
Diffstat (limited to 'src/google/protobuf/generated_message_util.h')
-rw-r--r--src/google/protobuf/generated_message_util.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/google/protobuf/generated_message_util.h b/src/google/protobuf/generated_message_util.h
index 871acca5..8dc64c49 100644
--- a/src/google/protobuf/generated_message_util.h
+++ b/src/google/protobuf/generated_message_util.h
@@ -84,6 +84,12 @@ class ExplicitlyConstructed {
}
bool IsInitialized() { return init_; }
+ void Shutdown() {
+ if (init_) {
+ init_ = false;
+ get_mutable()->~T();
+ }
+ }
const T& get() const { return reinterpret_cast<const T&>(union_); }
T* get_mutable() { return reinterpret_cast<T*>(&union_); }