Bug 845234 - Add null check in VectorImage's listener Cancel methods. r=dholbert

This commit is contained in:
Seth Fowler 2013-02-26 13:21:07 -08:00
parent f857806f73
commit 68f9bf1917

View File

@ -134,8 +134,10 @@ public:
void Cancel()
{
NS_ABORT_IF_FALSE(mDocument, "Duplicate call to Cancel");
mDocument->RemoveObserver(this);
mDocument = nullptr;
if (mDocument) {
mDocument->RemoveObserver(this);
mDocument = nullptr;
}
}
private:
@ -199,10 +201,12 @@ public:
void Cancel()
{
NS_ABORT_IF_FALSE(mDocument, "Duplicate call to Cancel");
mDocument->RemoveEventListener(NS_LITERAL_STRING("MozSVGAsImageDocumentLoad"), this, true);
mDocument->RemoveEventListener(NS_LITERAL_STRING("SVGAbort"), this, true);
mDocument->RemoveEventListener(NS_LITERAL_STRING("SVGError"), this, true);
mDocument = nullptr;
if (mDocument) {
mDocument->RemoveEventListener(NS_LITERAL_STRING("MozSVGAsImageDocumentLoad"), this, true);
mDocument->RemoveEventListener(NS_LITERAL_STRING("SVGAbort"), this, true);
mDocument->RemoveEventListener(NS_LITERAL_STRING("SVGError"), this, true);
mDocument = nullptr;
}
}
private: