Fix for leaks. Bug 48126 r=dbaron, hyatt
git-svn-id: svn://10.0.0.236/trunk@76074 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -826,9 +826,7 @@ nsImageMap::~nsImageMap()
|
||||
FreeAreas();
|
||||
if (nsnull != mDocument) {
|
||||
mDocument->RemoveObserver(NS_STATIC_CAST(nsIDocumentObserver*, this));
|
||||
NS_RELEASE(mDocument);
|
||||
}
|
||||
NS_IF_RELEASE(mDomMap);
|
||||
NS_IF_RELEASE(mMap);
|
||||
}
|
||||
|
||||
@@ -877,13 +875,15 @@ nsImageMap::Init(nsIDOMHTMLMapElement* aMap)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
mDomMap = aMap;
|
||||
NS_ADDREF(aMap);
|
||||
|
||||
nsresult rv = aMap->QueryInterface(kIContentIID, (void**) &mMap);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = mMap->GetDocument(mDocument);
|
||||
if (NS_SUCCEEDED(rv) && (nsnull != mDocument)) {
|
||||
mDocument->AddObserver(NS_STATIC_CAST(nsIDocumentObserver*, this));
|
||||
// mDocument is a weak reference, so release the reference we got
|
||||
nsIDocument *temp = mDocument;
|
||||
NS_RELEASE(temp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ protected:
|
||||
nsresult ChangeFocus(nsIDOMEvent* aEvent, PRBool aFocus);
|
||||
nsresult Invalidate(nsIPresContext* aPresContext, nsIFrame* aFrame, nsRect& aRect);
|
||||
|
||||
nsIDocument* mDocument;
|
||||
nsIDocument* mDocument; // WEAK - the imagemap will not outlive the document
|
||||
nsIDOMHTMLMapElement* mDomMap;
|
||||
nsIContent* mMap;
|
||||
nsVoidArray mAreas;
|
||||
|
||||
@@ -826,9 +826,7 @@ nsImageMap::~nsImageMap()
|
||||
FreeAreas();
|
||||
if (nsnull != mDocument) {
|
||||
mDocument->RemoveObserver(NS_STATIC_CAST(nsIDocumentObserver*, this));
|
||||
NS_RELEASE(mDocument);
|
||||
}
|
||||
NS_IF_RELEASE(mDomMap);
|
||||
NS_IF_RELEASE(mMap);
|
||||
}
|
||||
|
||||
@@ -877,13 +875,15 @@ nsImageMap::Init(nsIDOMHTMLMapElement* aMap)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
mDomMap = aMap;
|
||||
NS_ADDREF(aMap);
|
||||
|
||||
nsresult rv = aMap->QueryInterface(kIContentIID, (void**) &mMap);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = mMap->GetDocument(mDocument);
|
||||
if (NS_SUCCEEDED(rv) && (nsnull != mDocument)) {
|
||||
mDocument->AddObserver(NS_STATIC_CAST(nsIDocumentObserver*, this));
|
||||
// mDocument is a weak reference, so release the reference we got
|
||||
nsIDocument *temp = mDocument;
|
||||
NS_RELEASE(temp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ protected:
|
||||
nsresult ChangeFocus(nsIDOMEvent* aEvent, PRBool aFocus);
|
||||
nsresult Invalidate(nsIPresContext* aPresContext, nsIFrame* aFrame, nsRect& aRect);
|
||||
|
||||
nsIDocument* mDocument;
|
||||
nsIDocument* mDocument; // WEAK - the imagemap will not outlive the document
|
||||
nsIDOMHTMLMapElement* mDomMap;
|
||||
nsIContent* mMap;
|
||||
nsVoidArray mAreas;
|
||||
|
||||
Reference in New Issue
Block a user