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

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

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