Make sure we remove our RefreshDriver observers in CompleteAsyncScroll.

Follow-up to fdbac095968bc952fec6a03765a7156940ae4733
This commit is contained in:
wolfbeast 2018-11-02 10:47:05 +01:00 committed by Roy Tam
commit bf30898e2c
2 changed files with 12 additions and 2 deletions

View file

@ -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;
}
}