Assert that we destroy ElementAnimations/ElementTransitions through its Destroy() method. (Bug 653644) r=bzbarsky

This commit is contained in:
L. David Baron 2011-04-30 15:16:19 -07:00
parent aa3677a93e
commit 9f0f3f6deb
3 changed files with 17 additions and 0 deletions

View File

@ -148,12 +148,17 @@ struct CommonElementAnimationData : public PRCList
: mElement(aElement)
, mElementProperty(aElementProperty)
, mManager(aManager)
#ifdef DEBUG
, mCalledPropertyDtor(false)
#endif
{
MOZ_COUNT_CTOR(CommonElementAnimationData);
PR_INIT_CLIST(this);
}
~CommonElementAnimationData()
{
NS_ABORT_IF_FALSE(mCalledPropertyDtor,
"must call destructor through element property dtor");
MOZ_COUNT_DTOR(CommonElementAnimationData);
PR_REMOVE_LINK(this);
mManager->ElementDataRemoved();
@ -172,6 +177,10 @@ struct CommonElementAnimationData : public PRCList
nsIAtom *mElementProperty;
CommonAnimationManager *mManager;
#ifdef DEBUG
bool mCalledPropertyDtor;
#endif
};
}

View File

@ -159,6 +159,10 @@ ElementAnimationsPropertyDtor(void *aObject,
void *aData)
{
ElementAnimations *ea = static_cast<ElementAnimations*>(aPropertyValue);
#ifdef DEBUG
NS_ABORT_IF_FALSE(!ea->mCalledPropertyDtor, "can't call dtor twice");
ea->mCalledPropertyDtor = true;
#endif
delete ea;
}

View File

@ -170,6 +170,10 @@ ElementTransitionsPropertyDtor(void *aObject,
void *aData)
{
ElementTransitions *et = static_cast<ElementTransitions*>(aPropertyValue);
#ifdef DEBUG
NS_ABORT_IF_FALSE(!et->mCalledPropertyDtor, "can't call dtor twice");
et->mCalledPropertyDtor = true;
#endif
delete et;
}