Bug 328344, action module elements leak, r=aaronr+doronr

git-svn-id: svn://10.0.0.236/trunk@191175 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
Olli.Pettay%helsinki.fi
2006-02-24 19:13:43 +00:00
parent c55998f38e
commit fbce22d79e
4 changed files with 21 additions and 10 deletions

View File

@@ -49,7 +49,7 @@
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMEventTarget.h"
nsXFormsActionModuleBase::nsXFormsActionModuleBase()
nsXFormsActionModuleBase::nsXFormsActionModuleBase() : mElement(nsnull)
{
}
@@ -65,7 +65,13 @@ NS_IMPL_ISUPPORTS_INHERITED2(nsXFormsActionModuleBase,
NS_IMETHODIMP
nsXFormsActionModuleBase::OnCreated(nsIXTFGenericElementWrapper *aWrapper)
{
aWrapper->GetElementNode(getter_AddRefs(mElement));
// It's ok to keep a weak pointer to mElement. mElement will have an
// owning reference to this object, so as long as we null out mElement in
// OnDestroyed, it will always be valid.
nsCOMPtr<nsIDOMElement> node;
aWrapper->GetElementNode(getter_AddRefs(node));
mElement = node;
NS_ASSERTION(mElement, "Wrapper is not an nsIDOMElement, we'll crash soon");
return NS_OK;
}