Bug 1431204 - Only addref the mutator if is not null r=mayhemer
authorValentin Gosu <valentin.gosu@gmail.com>
Fri, 19 Jan 2018 15:26:03 +0100
changeset 454361 4070ee4b8315abe9753f239128d8242c80db9d63
parent 454360 24e867a67e1fa9818438094b31d1fdd6411486a5
child 454362 318a2d06a2d075ff1624f98a574636754dde7f03
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs1431204
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1431204 - Only addref the mutator if is not null r=mayhemer MozReview-Commit-ID: 94VsIsLxx2T
caps/NullPrincipalURI.h
image/decoders/icon/nsIconURI.h
--- a/caps/NullPrincipalURI.h
+++ b/caps/NullPrincipalURI.h
@@ -73,17 +73,20 @@ public:
     NS_IMETHOD Finalize(nsIURI** aURI) override
     {
       mURI.forget(aURI);
       return NS_OK;
     }
 
     NS_IMETHOD SetSpec(const nsACString & aSpec, nsIURIMutator** aMutator) override
     {
-      NS_ADDREF(*aMutator = this);
+      if (aMutator) {
+        nsCOMPtr<nsIURIMutator> mutator = this;
+        mutator.forget(aMutator);
+      }
       return NS_ERROR_NOT_IMPLEMENTED;
     }
 
     explicit Mutator() { }
   private:
     virtual ~Mutator() { }
 
     friend class NullPrincipalURI;
--- a/image/decoders/icon/nsIconURI.h
+++ b/image/decoders/icon/nsIconURI.h
@@ -64,18 +64,22 @@ public:
     }
 
     NS_IMETHOD Finalize(nsIURI** aURI) override
     {
       mURI.forget(aURI);
       return NS_OK;
     }
 
-    NS_IMETHOD SetSpec(const nsACString & aSpec, nsIURIMutator** aMutator) override {
-      NS_ADDREF(*aMutator = this);
+    NS_IMETHOD SetSpec(const nsACString & aSpec, nsIURIMutator** aMutator) override
+    {
+      if (aMutator) {
+        nsCOMPtr<nsIURIMutator> mutator = this;
+        mutator.forget(aMutator);
+      }
       return InitFromSpec(aSpec);
     }
 
     explicit Mutator() { }
   private:
     virtual ~Mutator() { }
 
     friend class nsMozIconURI;