Bug 1495554. Call StopObserving in SVGRenderingObserver's dtor instead of individual subclasses' dtors. r=longsonr
☠☠ backed out by 1d68c706356c ☠ ☠
authorJonathan Watt <jwatt@jwatt.org>
Fri, 21 Sep 2018 21:16:49 +0100
changeset 494824 28792d9adea23297a9c5e330fcbfab0203e2350c
parent 494823 6394f3198d88f4db82bf5333aaaad66a57a00899
child 494825 ec5d3c12ad4c9b8d3c2eea2b0f71f5dc3c15f15f
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslongsonr
bugs1495554
milestone64.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 1495554. Call StopObserving in SVGRenderingObserver's dtor instead of individual subclasses' dtors. r=longsonr Differential Revision: https://phabricator.services.mozilla.com/D7328
image/VectorImage.cpp
layout/svg/SVGObserverUtils.cpp
layout/svg/SVGObserverUtils.h
--- a/image/VectorImage.cpp
+++ b/image/VectorImage.cpp
@@ -75,20 +75,17 @@ public:
 
 
   void ResumeHonoringInvalidations()
   {
     mHonoringInvalidations = true;
   }
 
 protected:
-  virtual ~SVGRootRenderingObserver()
-  {
-    StopObserving();
-  }
+  virtual ~SVGRootRenderingObserver() = default; // non-public
 
   Element* GetReferencedElementWithoutObserving() override
   {
     return mDocWrapper->GetRootSVGElem();
   }
 
   virtual void OnRenderingChange() override
   {
--- a/layout/svg/SVGObserverUtils.cpp
+++ b/layout/svg/SVGObserverUtils.cpp
@@ -225,21 +225,20 @@ SVGRenderingObserver::ContentRemoved(nsI
  * object derived from SVGIDRenderingObserver to manage the relationship. The
  * property object is attached to the referencing frame.
  */
 class SVGIDRenderingObserver : public SVGRenderingObserver
 {
 public:
   SVGIDRenderingObserver(URLAndReferrerInfo* aURI, nsIContent* aObservingContent,
                          bool aReferenceImage);
-  virtual ~SVGIDRenderingObserver() {
-    StopObserving();
-  }
 
 protected:
+  virtual ~SVGIDRenderingObserver() = default; // non-public
+
   Element* GetReferencedElementWithoutObserving() override {
     return mObservedElementTracker.get();
   }
 
   void OnRenderingChange() override;
 
   /**
    * Helper that provides a reference to the element with the ID that our
--- a/layout/svg/SVGObserverUtils.h
+++ b/layout/svg/SVGObserverUtils.h
@@ -90,20 +90,16 @@ private:
  * OnRenderingChange will be called once the element in the external resource
  * is available.
  *
  * Although the referenced element may be found and stored during construction,
  * observing for rendering changes does not start until requested.
  */
 class SVGRenderingObserver : public nsStubMutationObserver
 {
-
-protected:
-  virtual ~SVGRenderingObserver() = default;
-
 public:
   typedef mozilla::dom::Element Element;
 
   SVGRenderingObserver()
     : mInObserverList(false)
   {}
 
   // nsIMutationObserver
@@ -135,16 +131,20 @@ public:
   nsIFrame* GetAndObserveReferencedFrame(mozilla::LayoutFrameType aFrameType,
                                          bool* aOK);
 
   Element* GetAndObserveReferencedElement();
 
   virtual bool ObservesReflow() { return true; }
 
 protected:
+  virtual ~SVGRenderingObserver() {
+    StopObserving();
+  }
+
   void StartObserving();
   void StopObserving();
 
   /**
    * Called whenever the rendering of the observed element may have changed.
    *
    * More specifically, this method is called whenever DOM mutation occurs in
    * the observed element's subtree, or whenever