19578 r=akhil.arora@sun.com fix=Denis Sharypov <sdv@sparc.spb.su>

Defer deleting the current element until the next iteration so that we can
  dereference the element first to get to the next element.
This commit is contained in:
akhil.arora%sun.com 1999-11-22 22:01:23 +00:00
parent ec924f35d9
commit 0b50b6daa1

View File

@ -522,20 +522,21 @@ void JavaDOMGlobals::TakeOutGarbage()
PRCList* chain = NULL;
PRCList* elem = NULL;
for (chain = garbage.next;
for (chain = PR_LIST_HEAD(&garbage);
chain != &garbage;
chain = PR_NEXT_LINK(chain)) {
elem = chain;
delete elem;
elem = chain;
domo = ((jniDOMGarbage*) elem)->domObject;
PR_LOG(log, PR_LOG_DEBUG,
("JavaDOMGlobals::TakeOutGarbage: Releasing %x\n", domo));
domo->Release();
domo = NULL;
delete elem;
count++;
}
delete elem;
PR_INIT_CLIST(&garbage);
if (count)