Free remaining stack items in destructor to fix leaking pretty much everything. b=230264 r=caillon sr=bryner

This commit is contained in:
dbaron%dbaron.org 2004-01-07 22:17:05 +00:00
Родитель 26454ef8ab
Коммит 4bc6810bf9
1 изменённых файлов: 21 добавлений и 11 удалений

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

@ -54,26 +54,36 @@
////////////////////////////////////////////////////
inDeepTreeWalker::inDeepTreeWalker()
MOZ_DECL_CTOR_COUNTER(DeepTreeStackItem)
struct DeepTreeStackItem
{
DeepTreeStackItem() { MOZ_COUNT_CTOR(DeepTreeStackItem); }
~DeepTreeStackItem() { MOZ_COUNT_DTOR(DeepTreeStackItem); }
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIDOMNodeList> kids;
PRUint32 lastIndex;
};
////////////////////////////////////////////////////
inDeepTreeWalker::inDeepTreeWalker()
: mShowAnonymousContent(PR_FALSE),
mShowSubDocuments(PR_FALSE),
mWhatToShow(nsIDOMNodeFilter::SHOW_ALL)
{
mShowAnonymousContent = PR_FALSE;
mShowSubDocuments = PR_FALSE;
mWhatToShow = nsIDOMNodeFilter::SHOW_ALL;
}
inDeepTreeWalker::~inDeepTreeWalker()
{
for (PRInt32 i = mStack.Count() - 1; i >= 0; --i) {
delete NS_STATIC_CAST(DeepTreeStackItem*, mStack[i]);
}
}
NS_IMPL_ISUPPORTS1(inDeepTreeWalker, inIDeepTreeWalker)
typedef struct _DeepTreeStackItem
{
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIDOMNodeList> kids;
PRUint32 lastIndex;
} DeepTreeStackItem;
////////////////////////////////////////////////////
// inIDeepTreeWalker