Bug 1495851. Comment why StopObserving is called in SVGRenderingObserver base class dtors. r=longsonr
authorJonathan Watt <jwatt@jwatt.org>
Tue, 25 Sep 2018 10:40:12 +0100
changeset 495063 c56f786879faa26006b91338dfb04eba977aadbf
parent 495062 d04fa630f0fac22c8fd7ece46c3a6ac9a6dfaba6
child 495064 2bfca7a1d88be55d2d784e3647226272908b9b12
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
bugs1495851
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 1495851. Comment why StopObserving is called in SVGRenderingObserver base class dtors. r=longsonr Differential Revision: https://phabricator.services.mozilla.com/D7525
image/VectorImage.cpp
layout/svg/SVGObserverUtils.cpp
--- a/image/VectorImage.cpp
+++ b/image/VectorImage.cpp
@@ -77,20 +77,22 @@ public:
   void ResumeHonoringInvalidations()
   {
     mHonoringInvalidations = true;
   }
 
 protected:
   virtual ~SVGRootRenderingObserver()
   {
+    // This needs to call our GetReferencedElementWithoutObserving override,
+    // so must be called here rather than in our base class's dtor.
     StopObserving();
   }
 
-  Element* GetReferencedElementWithoutObserving() override
+  Element* GetReferencedElementWithoutObserving() final
   {
     return mDocWrapper->GetRootSVGElem();
   }
 
   virtual void OnRenderingChange() override
   {
     Element* elem = GetReferencedElementWithoutObserving();
     MOZ_ASSERT(elem, "missing root SVG node");
--- a/layout/svg/SVGObserverUtils.cpp
+++ b/layout/svg/SVGObserverUtils.cpp
@@ -225,22 +225,25 @@ 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);
+
+protected:
   virtual ~SVGIDRenderingObserver() {
+    // This needs to call our GetReferencedElementWithoutObserving override,
+    // so must be called here rather than in our base class's dtor.
     StopObserving();
   }
 
-protected:
-  Element* GetReferencedElementWithoutObserving() override {
+  Element* GetReferencedElementWithoutObserving() final {
     return mObservedElementTracker.get();
   }
 
   void OnRenderingChange() override;
 
   /**
    * Helper that provides a reference to the element with the ID that our
    * observer wants to observe, and that will invalidate our observer if the