Browse Source

Explicitly call destructor of Mutex to release resources.

Change-Id: I808f4a3689e723d4490aa9ba6f1c14e3936ddcec
Feng Xiao 10 years ago
parent
commit
4e0c46f93d
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/google/protobuf/map_field.h

+ 5 - 1
src/google/protobuf/map_field.h

@@ -68,7 +68,11 @@ class LIBPROTOBUF_EXPORT MapFieldBase {
         repeated_field_(NULL),
         repeated_field_(NULL),
         entry_descriptor_(NULL),
         entry_descriptor_(NULL),
         assign_descriptor_callback_(NULL),
         assign_descriptor_callback_(NULL),
-        state_(STATE_MODIFIED_MAP) {}
+        state_(STATE_MODIFIED_MAP) {
+    // Mutex's destructor needs to be called explicitly to release resources
+    // acquired in its constructor.
+    arena->OwnDestructor(&mutex_);
+  }
   virtual ~MapFieldBase();
   virtual ~MapFieldBase();
 
 
   // Returns reference to internal repeated field. Data written using
   // Returns reference to internal repeated field. Data written using