Эх сурвалжийг харах

Fix final leak (win32 only).

kenton@google.com 16 жил өмнө
parent
commit
b43727981c

+ 6 - 0
src/google/protobuf/stubs/once.cc

@@ -56,6 +56,12 @@ struct GoogleOnceInternal {
   CRITICAL_SECTION critical_section;
   CRITICAL_SECTION critical_section;
 };
 };
 
 
+GoogleOnceType::~GoogleOnceType()
+{
+  delete internal_;
+  internal_ = NULL;
+}
+
 GoogleOnceType::GoogleOnceType() {
 GoogleOnceType::GoogleOnceType() {
   // internal_ may be non-NULL if Init() was already called.
   // internal_ may be non-NULL if Init() was already called.
   if (internal_ == NULL) internal_ = new GoogleOnceInternal;
   if (internal_ == NULL) internal_ = new GoogleOnceInternal;

+ 1 - 0
src/google/protobuf/stubs/once.h

@@ -87,6 +87,7 @@ struct GoogleOnceInternal;
 
 
 struct LIBPROTOBUF_EXPORT GoogleOnceType {
 struct LIBPROTOBUF_EXPORT GoogleOnceType {
   GoogleOnceType();
   GoogleOnceType();
+  ~GoogleOnceType();
   void Init(void (*init_func)());
   void Init(void (*init_func)());
 
 
   volatile bool initialized_;
   volatile bool initialized_;