Reduce the risk of parser leaks by releasing the parsers owned by CSSLoaders when no longer needed. r=attinasi

This commit is contained in:
dbaron%fas.harvard.edu 2000-08-16 23:04:42 +00:00
Родитель 852596cc10
Коммит 74fd1f046f
3 изменённых файлов: 30 добавлений и 12 удалений

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

@ -696,12 +696,18 @@ CSSLoaderImpl::Cleanup(URLKey& aKey, SheetLoadData* aLoadData)
NS_ASSERTION(oldData == aLoadData, "broken loading table");
}
// unblock parser
// release all parsers, but we only need to unblock one
data = aLoadData;
PRBool done = PR_FALSE;
do {
if (data->mParserToUnblock && data->mDidBlockParser) {
data->mParserToUnblock->EnableParser(PR_TRUE); // this may result in re-entrant calls to loader
break;
if (data->mParserToUnblock) {
if (!done && data->mDidBlockParser) {
done = PR_TRUE;
data->mParserToUnblock->EnableParser(PR_TRUE); // this may result in re-entrant calls to loader
}
// To reduce the risk of leaking a parser if we leak a SheetLoadData,
// release the parser here.
NS_RELEASE(data->mParserToUnblock); // assigns nsnull
}
data = data->mNext;
} while (data);

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

@ -696,12 +696,18 @@ CSSLoaderImpl::Cleanup(URLKey& aKey, SheetLoadData* aLoadData)
NS_ASSERTION(oldData == aLoadData, "broken loading table");
}
// unblock parser
// release all parsers, but we only need to unblock one
data = aLoadData;
PRBool done = PR_FALSE;
do {
if (data->mParserToUnblock && data->mDidBlockParser) {
data->mParserToUnblock->EnableParser(PR_TRUE); // this may result in re-entrant calls to loader
break;
if (data->mParserToUnblock) {
if (!done && data->mDidBlockParser) {
done = PR_TRUE;
data->mParserToUnblock->EnableParser(PR_TRUE); // this may result in re-entrant calls to loader
}
// To reduce the risk of leaking a parser if we leak a SheetLoadData,
// release the parser here.
NS_RELEASE(data->mParserToUnblock); // assigns nsnull
}
data = data->mNext;
} while (data);

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

@ -696,12 +696,18 @@ CSSLoaderImpl::Cleanup(URLKey& aKey, SheetLoadData* aLoadData)
NS_ASSERTION(oldData == aLoadData, "broken loading table");
}
// unblock parser
// release all parsers, but we only need to unblock one
data = aLoadData;
PRBool done = PR_FALSE;
do {
if (data->mParserToUnblock && data->mDidBlockParser) {
data->mParserToUnblock->EnableParser(PR_TRUE); // this may result in re-entrant calls to loader
break;
if (data->mParserToUnblock) {
if (!done && data->mDidBlockParser) {
done = PR_TRUE;
data->mParserToUnblock->EnableParser(PR_TRUE); // this may result in re-entrant calls to loader
}
// To reduce the risk of leaking a parser if we leak a SheetLoadData,
// release the parser here.
NS_RELEASE(data->mParserToUnblock); // assigns nsnull
}
data = data->mNext;
} while (data);