Bug 654182, svgnumberlist keeps a strong pointer to element, r=dholbert

This commit is contained in:
Olli Pettay 2011-05-02 22:19:20 +03:00
Родитель bf59741c06
Коммит a0c9b6dfaf
1 изменённых файлов: 7 добавлений и 5 удалений

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

@ -179,15 +179,16 @@ public:
{}
SVGNumberListAndInfo(nsSVGElement *aElement)
: mElement(aElement)
: mElement(do_GetWeakReference(static_cast<nsINode*>(aElement)))
{}
void SetInfo(nsSVGElement *aElement) {
mElement = aElement;
mElement = do_GetWeakReference(static_cast<nsINode*>(aElement));
}
nsSVGElement* Element() const {
return mElement; // .get();
nsCOMPtr<nsIContent> e = do_QueryReferent(mElement);
return static_cast<nsSVGElement*>(e.get());
}
nsresult CopyFrom(const SVGNumberListAndInfo& rhs) {
@ -218,10 +219,11 @@ public:
}
private:
// We must keep a strong reference to our element because we may belong to a
// We must keep a weak reference to our element because we may belong to a
// cached baseVal nsSMILValue. See the comments starting at:
// https://bugzilla.mozilla.org/show_bug.cgi?id=515116#c15
nsRefPtr<nsSVGElement> mElement;
// See also https://bugzilla.mozilla.org/show_bug.cgi?id=653497
nsWeakPtr mElement;
};
} // namespace mozilla