From 3b2c342f3879705b0cc9919198b984f92aec5e62 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Fri, 2 Nov 2018 10:47:05 +0100 Subject: Make sure we remove our RefreshDriver observers in CompleteAsyncScroll. Follow-up to fdbac095968bc952fec6a03765a7156940ae4733 --- layout/generic/nsGfxScrollFrame.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'layout/generic/nsGfxScrollFrame.cpp') diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index cfa366aa3..3ed3b0bb3 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -2152,8 +2152,7 @@ void ScrollFrameHelper::CompleteAsyncScroll(const nsRect &aRange, nsIAtom* aOrigin) { // Apply desired destination range since this is the last step of scrolling. - mAsyncSmoothMSDScroll = nullptr; - mAsyncScroll = nullptr; + RemoveObservers(); nsWeakFrame weakFrame(mOuter); ScrollToImpl(mDestination, aRange, aOrigin); if (!weakFrame.IsAlive()) { @@ -4588,11 +4587,19 @@ ScrollFrameHelper::Destroy() mScrollActivityTimer->Cancel(); mScrollActivityTimer = nullptr; } + RemoveObservers(); +} + +void +ScrollFrameHelper::RemoveObservers() +{ if (mAsyncScroll) { mAsyncScroll->RemoveObserver(); + mAsyncScroll = nullptr; } if (mAsyncSmoothMSDScroll) { mAsyncSmoothMSDScroll->RemoveObserver(); + mAsyncSmoothMSDScroll = nullptr; } } -- cgit v1.2.3