bug 489135: fix old PRMonitor leak, init debug var in mozilla::Monitor. r=smontagu
authorChris Jones <jones.chris.g@gmail.com>
Tue, 21 Apr 2009 00:33:12 +0200
changeset 27555 fbfbc1e04f4ee344295e3404045461cffde22eaa
parent 27554 343a046740771b6b7b8f9b5645001ae79f3c15d1
child 27556 8ecdcd32c27ab13644b2d91ebd4f178b10923a51
push id6609
push usersgautherie.bz@free.fr
push dateMon, 20 Apr 2009 22:34:58 +0000
treeherdermozilla-central@fbfbc1e04f4e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmontagu
bugs489135
milestone1.9.2a1pre
bug 489135: fix old PRMonitor leak, init debug var in mozilla::Monitor. r=smontagu
intl/strres/src/nsStringBundle.cpp
xpcom/glue/Monitor.h
--- a/intl/strres/src/nsStringBundle.cpp
+++ b/intl/strres/src/nsStringBundle.cpp
@@ -77,16 +77,18 @@
 #include "prenv.h"
 #include "nsCRT.h"
 
 static NS_DEFINE_CID(kErrorServiceCID, NS_ERRORSERVICE_CID);
 static NS_DEFINE_CID(kPersistentPropertiesCID, NS_IPERSISTENTPROPERTIES_CID);
 
 nsStringBundle::~nsStringBundle()
 {
+  if (mMonitor)
+    PR_DestroyMonitor(mMonitor);
 }
 
 nsStringBundle::nsStringBundle(const char* aURLSpec,
                                nsIStringBundleOverride* aOverrideStrings) :
   mPropertiesURL(aURLSpec),
   mOverrideStrings(aOverrideStrings),
   mMonitor(0),
   mAttemptedLoad(PR_FALSE),
--- a/xpcom/glue/Monitor.h
+++ b/xpcom/glue/Monitor.h
@@ -67,17 +67,21 @@ class NS_COM_GLUE Monitor : BlockingReso
 public:
     /**
      * Monitor
      * @param name A name which can reference this monitor
      * @returns If failure, nsnull
      *          If success, a valid Monitor*, which must be destroyed
      *          by Monitor::DestroyMonitor()
      **/
-    Monitor(const char* name) {
+    Monitor(const char* name)
+#ifdef DEBUG
+        : mEntryCount(0)
+#endif
+    {
         mMonitor = PR_NewMonitor();
         if (!mMonitor)
             NS_RUNTIMEABORT("Can't allocate mozilla::Monitor");
         Init(mMonitor, name, eMonitor);
     }
 
     /**
      * ~Monitor