Fix leak of style contexts from vertical splitters. b=108642 r=hewitt sr=bienvenu

This commit is contained in:
dbaron%fas.harvard.edu 2001-11-22 21:41:47 +00:00
Родитель d84431bbb0
Коммит aa26bb26ef
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -344,6 +344,8 @@ nsSplitterFrame::Init(nsIPresContext* aPresContext,
nsIBox* boxParent;
if (aParent)
CallQueryInterface(aParent, &boxParent);
// |newContext| to Release the reference after the call to nsBoxFrame::Init
nsCOMPtr<nsIStyleContext> newContext;
if (boxParent) {
PRBool isHorizontal;
boxParent->GetOrientation(isHorizontal);
@ -353,7 +355,10 @@ nsSplitterFrame::Init(nsIPresContext* aPresContext,
if (str.IsEmpty()) {
aContent->SetAttr(kNameSpaceID_None, nsXULAtoms::orient,
NS_LITERAL_STRING("vertical"), PR_FALSE);
aPresContext->ResolveStyleContextFor(aContent, aContext->GetParent(), PR_FALSE, &aContext);
nsCOMPtr<nsIStyleContext> parent = dont_AddRef(aContext->GetParent());
aPresContext->ResolveStyleContextFor(aContent, parent, PR_FALSE,
getter_AddRefs(newContext));
aContext = newContext;
}
}
}