Bug 638549 - fix leak of WebGL about:memory reporters - r=jrmuizel
authorBenoit Jacob <bjacob@mozilla.com>
Wed, 10 Aug 2011 18:25:23 -0400
changeset 74196 55b4a5e8b5a35b96f1754b9bcd60cf108fcd96a1
parent 74195 9c43ba0259fa1536a8caf18efeb1995a5555ff85
child 74197 a1b3ba6eabf8dcfaa17e8ee82d45065c9446fe5e
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersjrmuizel
bugs638549
milestone8.0a1
Bug 638549 - fix leak of WebGL about:memory reporters - r=jrmuizel See bug 638549 comment 25. We had to ref-count these pointers.
content/canvas/src/WebGLContext.h
--- a/content/canvas/src/WebGLContext.h
+++ b/content/canvas/src/WebGLContext.h
@@ -2178,27 +2178,27 @@ class WebGLMemoryReporter
     ~WebGLMemoryReporter();
     static WebGLMemoryReporter* sUniqueInstance;
 
     // here we store plain pointers, not RefPtrs: we don't want the WebGLMemoryReporter unique instance to keep alive all
     // WebGLContexts ever created.
     typedef nsTArray<const WebGLContext*> ContextsArrayType;
     ContextsArrayType mContexts;
     
-    nsIMemoryReporter *mTextureMemoryUsageReporter;
-    nsIMemoryReporter *mTextureCountReporter;
-    nsIMemoryReporter *mBufferMemoryUsageReporter;
-    nsIMemoryReporter *mBufferCacheMemoryUsageReporter;
-    nsIMemoryReporter *mBufferCountReporter;
-    nsIMemoryReporter *mRenderbufferMemoryUsageReporter;
-    nsIMemoryReporter *mRenderbufferCountReporter;
-    nsIMemoryReporter *mShaderSourcesSizeReporter;
-    nsIMemoryReporter *mShaderTranslationLogsSizeReporter;
-    nsIMemoryReporter *mShaderCountReporter;
-    nsIMemoryReporter *mContextCountReporter;
+    nsCOMPtr<nsIMemoryReporter> mTextureMemoryUsageReporter;
+    nsCOMPtr<nsIMemoryReporter> mTextureCountReporter;
+    nsCOMPtr<nsIMemoryReporter> mBufferMemoryUsageReporter;
+    nsCOMPtr<nsIMemoryReporter> mBufferCacheMemoryUsageReporter;
+    nsCOMPtr<nsIMemoryReporter> mBufferCountReporter;
+    nsCOMPtr<nsIMemoryReporter> mRenderbufferMemoryUsageReporter;
+    nsCOMPtr<nsIMemoryReporter> mRenderbufferCountReporter;
+    nsCOMPtr<nsIMemoryReporter> mShaderSourcesSizeReporter;
+    nsCOMPtr<nsIMemoryReporter> mShaderTranslationLogsSizeReporter;
+    nsCOMPtr<nsIMemoryReporter> mShaderCountReporter;
+    nsCOMPtr<nsIMemoryReporter> mContextCountReporter;
 
     static WebGLMemoryReporter* UniqueInstance();
 
     static ContextsArrayType & Contexts() { return UniqueInstance()->mContexts; }
 
   public:
 
     static void AddWebGLContext(const WebGLContext* c) {