fixing addref/release errors in SelectAll code - fixes bug #2166

This commit is contained in:
jfrancis%netscape.com 1999-01-19 01:54:57 +00:00
Родитель 09dcebe273
Коммит 0b590ab2f8
2 изменённых файлов: 8 добавлений и 6 удалений

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

@ -1698,7 +1698,7 @@ NS_IMETHODIMP nsDocument::SelectAll() {
body = child;
break;
}
NS_IF_RELEASE(atom);
}
NS_RELEASE(child);
}
@ -1709,6 +1709,7 @@ NS_IMETHODIMP nsDocument::SelectAll() {
start = body;
// Find Very first Piece of Content
NS_ADDREF(start); //to balance release below
for (;;) {
start->ChildCount(n);
if (n <= 0) {
@ -1720,6 +1721,7 @@ NS_IMETHODIMP nsDocument::SelectAll() {
}
end = body;
NS_ADDREF(end); //to balance release below
// Last piece of Content
for (;;) {
end->ChildCount(n);
@ -1731,8 +1733,7 @@ NS_IMETHODIMP nsDocument::SelectAll() {
NS_RELEASE(child);
}
//NS_RELEASE(start);
//NS_RELEASE(end);
NS_RELEASE(body);
SetDisplaySelection(PR_TRUE);
return NS_OK;

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

@ -1698,7 +1698,7 @@ NS_IMETHODIMP nsDocument::SelectAll() {
body = child;
break;
}
NS_IF_RELEASE(atom);
}
NS_RELEASE(child);
}
@ -1709,6 +1709,7 @@ NS_IMETHODIMP nsDocument::SelectAll() {
start = body;
// Find Very first Piece of Content
NS_ADDREF(start); //to balance release below
for (;;) {
start->ChildCount(n);
if (n <= 0) {
@ -1720,6 +1721,7 @@ NS_IMETHODIMP nsDocument::SelectAll() {
}
end = body;
NS_ADDREF(end); //to balance release below
// Last piece of Content
for (;;) {
end->ChildCount(n);
@ -1731,8 +1733,7 @@ NS_IMETHODIMP nsDocument::SelectAll() {
NS_RELEASE(child);
}
//NS_RELEASE(start);
//NS_RELEASE(end);
NS_RELEASE(body);
SetDisplaySelection(PR_TRUE);
return NS_OK;