Bug 540868 part 3: when deallocating NPObjects in leakcount builds, let the leak monitor know that we cleaned them up correctly, r=bent
authorBenjamin Smedberg <benjamin@smedbergs.us>
Fri, 22 Jan 2010 10:06:30 -0500
changeset 37478 43ebc4244f7d38e4ce2c4cccd77b3d5fab1772c3
parent 37477 7145c2f478d9b75b9afb03f7c8a5d6a875e84f2c
child 37479 38e86af9675796a35fa8e9cc42b5aee339debe65
push id11325
push userbsmedberg@mozilla.com
push dateMon, 25 Jan 2010 14:50:07 +0000
treeherderautoland@38e86af96757 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs540868
milestone1.9.3a1pre
Bug 540868 part 3: when deallocating NPObjects in leakcount builds, let the leak monitor know that we cleaned them up correctly, r=bent
dom/plugins/PluginModuleChild.cpp
--- a/dom/plugins/PluginModuleChild.cpp
+++ b/dom/plugins/PluginModuleChild.cpp
@@ -1583,16 +1583,26 @@ PluginModuleChild::DeallocNPObject(NPObj
 PLDHashOperator
 PluginModuleChild::DeallocForInstance(NPObjectData* d, void* userArg)
 {
     if (d->instance == static_cast<PluginInstanceChild*>(userArg)) {
         NPObject* o = d->GetKey();
         if (o->_class && o->_class->invalidate)
             o->_class->invalidate(o);
 
+#ifdef NS_BUILD_REFCNT_LOGGING
+        {
+            int32_t refCnt = o->referenceCount;
+            while (refCnt) {
+                --refCnt;
+                NS_LOG_RELEASE(o, refCnt, "NPObject");
+            }
+        }
+#endif
+
         DeallocNPObject(o);
 
         if (d->actor)
             d->actor->NPObjectDestroyed();
 
         return PL_DHASH_REMOVE;
     }