Try to fix static-analysis errors re:lambdas and refcounteds. draft
authorJeff Gilbert <jdashg@gmail.com>
Thu, 17 Dec 2015 16:16:51 -0800
changeset 316080 a2b8cd9ca4162b3794aa3f9315fc02ba03af0255
parent 316079 96d9b10d0c81414adf03df0f2ecdf8849c66dd1b
child 316081 ff9277c9ed1e95fbc5bfbd4cc7d59291a7f76d59
push id8514
push userjgilbert@mozilla.com
push dateFri, 18 Dec 2015 00:24:33 +0000
milestone45.0a1
Try to fix static-analysis errors re:lambdas and refcounteds.
dom/canvas/WebGLExtensionCompressedTextureATC.cpp
dom/canvas/WebGLExtensionCompressedTextureETC1.cpp
dom/canvas/WebGLExtensionCompressedTexturePVRTC.cpp
dom/canvas/WebGLExtensionCompressedTextureS3TC.cpp
--- a/dom/canvas/WebGLExtensionCompressedTextureATC.cpp
+++ b/dom/canvas/WebGLExtensionCompressedTextureATC.cpp
@@ -11,23 +11,24 @@
 #error FOO is already defined! We use FOO() macros to keep things succinct in this file.
 #endif
 
 namespace mozilla {
 
 WebGLExtensionCompressedTextureATC::WebGLExtensionCompressedTextureATC(WebGLContext* webgl)
     : WebGLExtensionBase(webgl)
 {
-    const auto fnAdd = [webgl](GLenum sizedFormat, webgl::EffectiveFormat effFormat) {
-        auto& fua = webgl->mFormatUsage;
+    RefPtr<WebGLContext> webgl_ = webgl; // Bug 1201275
+    const auto fnAdd = [webgl_](GLenum sizedFormat, webgl::EffectiveFormat effFormat) {
+        auto& fua = webgl_->mFormatUsage;
 
         auto usage = fua->EditUsage(effFormat);
         fua->AddSizedTexFormat(sizedFormat, usage);
 
-        webgl->mCompressedTextureFormats.AppendElement(sizedFormat);
+        webgl_->mCompressedTextureFormats.AppendElement(sizedFormat);
     };
 
 #define FOO(x) LOCAL_GL_ ## x, webgl::EffectiveFormat::x
 
     fnAdd(FOO(ATC_RGB_AMD));
     fnAdd(FOO(ATC_RGBA_EXPLICIT_ALPHA_AMD));
     fnAdd(FOO(ATC_RGBA_INTERPOLATED_ALPHA_AMD));
 
--- a/dom/canvas/WebGLExtensionCompressedTextureETC1.cpp
+++ b/dom/canvas/WebGLExtensionCompressedTextureETC1.cpp
@@ -11,17 +11,17 @@
 #error FOO is already defined! We use FOO() macros to keep things succinct in this file.
 #endif
 
 namespace mozilla {
 
 WebGLExtensionCompressedTextureETC1::WebGLExtensionCompressedTextureETC1(WebGLContext* webgl)
     : WebGLExtensionBase(webgl)
 {
-    const auto fnAdd = [webgl](GLenum sizedFormat, webgl::EffectiveFormat effFormat) {
+    const auto fnAdd = [&webgl](GLenum sizedFormat, webgl::EffectiveFormat effFormat) {
         auto& fua = webgl->mFormatUsage;
 
         auto usage = fua->EditUsage(effFormat);
         fua->AddSizedTexFormat(sizedFormat, usage);
 
         webgl->mCompressedTextureFormats.AppendElement(sizedFormat);
     };
 
--- a/dom/canvas/WebGLExtensionCompressedTexturePVRTC.cpp
+++ b/dom/canvas/WebGLExtensionCompressedTexturePVRTC.cpp
@@ -11,17 +11,17 @@
 #error FOO is already defined! We use FOO() macros to keep things succinct in this file.
 #endif
 
 namespace mozilla {
 
 WebGLExtensionCompressedTexturePVRTC::WebGLExtensionCompressedTexturePVRTC(WebGLContext* webgl)
     : WebGLExtensionBase(webgl)
 {
-    const auto fnAdd = [webgl](GLenum sizedFormat, webgl::EffectiveFormat effFormat) {
+    const auto fnAdd = [&webgl](GLenum sizedFormat, webgl::EffectiveFormat effFormat) {
         auto& fua = webgl->mFormatUsage;
 
         auto usage = fua->EditUsage(effFormat);
         fua->AddSizedTexFormat(sizedFormat, usage);
 
         webgl->mCompressedTextureFormats.AppendElement(sizedFormat);
     };
 
--- a/dom/canvas/WebGLExtensionCompressedTextureS3TC.cpp
+++ b/dom/canvas/WebGLExtensionCompressedTextureS3TC.cpp
@@ -11,17 +11,17 @@
 #error FOO is already defined! We use FOO() macros to keep things succinct in this file.
 #endif
 
 namespace mozilla {
 
 WebGLExtensionCompressedTextureS3TC::WebGLExtensionCompressedTextureS3TC(WebGLContext* webgl)
     : WebGLExtensionBase(webgl)
 {
-    const auto fnAdd = [webgl](GLenum sizedFormat, webgl::EffectiveFormat effFormat) {
+    const auto fnAdd = [&webgl](GLenum sizedFormat, webgl::EffectiveFormat effFormat) {
         auto& fua = webgl->mFormatUsage;
 
         auto usage = fua->EditUsage(effFormat);
         fua->AddSizedTexFormat(sizedFormat, usage);
 
         webgl->mCompressedTextureFormats.AppendElement(sizedFormat);
     };