Bug 1234242 - Keep a RefPtr to the refresh driver to unregister the ScrollEvent, rather than relying on a chain of pointers remaining non-null. r=mstange a=KWierso

--HG--
extra : commitid : JouJUWdzJl6
This commit is contained in:
Kartikaya Gupta 2015-12-21 14:40:20 -05:00
Родитель 956117e0df
Коммит 4a4a0bcf45
2 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -4228,12 +4228,14 @@ void ScrollFrameHelper::CurPosAttributeChanged(nsIContent* aContent)
ScrollFrameHelper::ScrollEvent::ScrollEvent(ScrollFrameHelper* aHelper) ScrollFrameHelper::ScrollEvent::ScrollEvent(ScrollFrameHelper* aHelper)
: mHelper(aHelper) : mHelper(aHelper)
{ {
mHelper->mOuter->PresContext()->RefreshDriver()->AddRefreshObserver(this, Flush_Style); mDriver = mHelper->mOuter->PresContext()->RefreshDriver();
mDriver->AddRefreshObserver(this, Flush_Style);
} }
ScrollFrameHelper::ScrollEvent::~ScrollEvent() ScrollFrameHelper::ScrollEvent::~ScrollEvent()
{ {
mHelper->mOuter->PresContext()->RefreshDriver()->RemoveRefreshObserver(this, Flush_Style); mDriver->RemoveRefreshObserver(this, Flush_Style);
mDriver = nullptr;
} }
void void

Просмотреть файл

@ -111,6 +111,7 @@ public:
virtual ~ScrollEvent(); virtual ~ScrollEvent();
private: private:
ScrollFrameHelper *mHelper; ScrollFrameHelper *mHelper;
RefPtr<nsRefreshDriver> mDriver;
}; };
class AsyncScrollPortEvent : public nsRunnable { class AsyncScrollPortEvent : public nsRunnable {