Bug 877097: Hold strong refs to instances of ScrollbarActivity to avoid crashing. r=mats

This commit is contained in:
Stephen Pohl 2013-07-31 21:43:56 -04:00
parent 1340edfe51
commit 29b7462867
4 changed files with 9 additions and 5 deletions

View File

@ -88,7 +88,9 @@ public:
virtual void WillRefresh(TimeStamp aTime) MOZ_OVERRIDE;
static void FadeBeginTimerFired(nsITimer* aTimer, void* aSelf) {
reinterpret_cast<ScrollbarActivity*>(aSelf)->BeginFade();
nsRefPtr<ScrollbarActivity> scrollbarActivity(
reinterpret_cast<ScrollbarActivity*>(aSelf));
scrollbarActivity->BeginFade();
}
protected:

View File

@ -3014,7 +3014,8 @@ void nsGfxScrollFrameInner::CurPosAttributeChanged(nsIContent* aContent)
}
if (mScrollbarActivity) {
mScrollbarActivity->ActivityOccurred();
nsRefPtr<ScrollbarActivity> scrollbarActivity(mScrollbarActivity);
scrollbarActivity->ActivityOccurred();
}
bool isSmooth = aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::smooth);
@ -3889,7 +3890,8 @@ nsGfxScrollFrameInner::SetCoordAttribute(nsIContent* aContent, nsIAtom* aAtom,
aContent->SetAttr(kNameSpaceID_None, aAtom, newValue, true);
if (mScrollbarActivity) {
mScrollbarActivity->ActivityOccurred();
nsRefPtr<ScrollbarActivity> scrollbarActivity(mScrollbarActivity);
scrollbarActivity->ActivityOccurred();
}
}

View File

@ -287,7 +287,7 @@ public:
nsIFrame* mResizerBox;
nsContainerFrame* mOuter;
nsRefPtr<AsyncScroll> mAsyncScroll;
nsCOMPtr<ScrollbarActivity> mScrollbarActivity;
nsRefPtr<ScrollbarActivity> mScrollbarActivity;
nsTArray<nsIScrollPositionListener*> mListeners;
nsRect mScrollPort;
// Where we're currently scrolling to, if we're scrolling asynchronously.

View File

@ -543,7 +543,7 @@ protected: // Data Members
nsRevocableEventPtr<ScrollEvent> mScrollEvent;
nsCOMPtr<ScrollbarActivity> mScrollbarActivity;
nsRefPtr<ScrollbarActivity> mScrollbarActivity;
// The cached box object parent.
nsCOMPtr<nsITreeBoxObject> mTreeBoxObject;