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:
@@ -52,7 +52,7 @@
|
||||
#define DEFERRED_REVALIDATE 0x04
|
||||
#define DEFERRED_REFRESH 0x08
|
||||
|
||||
nsXFormsActionElement::nsXFormsActionElement()
|
||||
nsXFormsActionElement::nsXFormsActionElement() : mElement(nsnull)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -71,9 +71,14 @@ nsXFormsActionElement::OnCreated(nsIXTFXMLVisualWrapper *aWrapper)
|
||||
nsresult rv = nsXFormsXMLVisualStub::OnCreated(aWrapper);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = aWrapper->GetElementNode(getter_AddRefs(mElement));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// 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");
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
mElement->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||
rv = domDoc->CreateElementNS(NS_LITERAL_STRING(NS_NAMESPACE_XHTML),
|
||||
|
||||
@@ -60,9 +60,9 @@ public:
|
||||
NS_IMETHOD GetInsertionPoint(nsIDOMElement **aElement);
|
||||
NS_IMETHOD OnDestroyed();
|
||||
private:
|
||||
nsCOMPtr<nsIDOMElement> mElement;
|
||||
nsCOMPtr<nsIDOMElement> mVisualElement;
|
||||
nsCOMPtr<nsIXFormsActionElement> mParentAction;
|
||||
nsIDOMElement* mElement;
|
||||
nsCOMPtr<nsIDOMElement> mVisualElement;
|
||||
nsCOMPtr<nsIXFormsActionElement> mParentAction;
|
||||
nsDataHashtable<nsISupportsHashKey,PRUint32> mDeferredUpdates;
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
NS_DECL_NSIDOMEVENTLISTENER
|
||||
NS_IMETHOD OnDestroyed();
|
||||
protected:
|
||||
nsCOMPtr<nsIDOMElement> mElement;
|
||||
nsIDOMElement* mElement;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user