do not allow the stream listener to be freed during a call to OnDataAvailable... It is possible, that OnStopBinding() wil lbe called while the listener is processing the data (ie. the URL load is interrupted). If this happens, do not free the listener until the OnDataAvailable() call has finished...

This commit is contained in:
rpotts%netscape.com 1998-11-10 07:06:02 +00:00
Родитель a236dcc4da
Коммит 091d1a0344
2 изменённых файлов: 26 добавлений и 2 удалений

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

@ -1348,7 +1348,19 @@ NS_METHOD nsDocumentBindInfo::OnDataAvailable(nsIURL* aURL,
NS_PRECONDITION(nsnull !=m_NextStream, "DocLoader: No stream for document");
if (nsnull != m_NextStream) {
rv = m_NextStream->OnDataAvailable(aURL, aStream, aLength);
/*
* Bump the refcount in case the stream gets destroyed while the data
* is being processed... If Stop(...) is called the stream could be
* freed prematurely :-(
*
* Currently this can happen if javascript loads a new URL
* (via nsIWebShell::LoadURL) during the parse phase...
*/
nsIStreamListener* listener = m_NextStream;
NS_ADDREF(listener);
rv = listener->OnDataAvailable(aURL, aStream, aLength);
NS_RELEASE(listener);
}
done:

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

@ -1348,7 +1348,19 @@ NS_METHOD nsDocumentBindInfo::OnDataAvailable(nsIURL* aURL,
NS_PRECONDITION(nsnull !=m_NextStream, "DocLoader: No stream for document");
if (nsnull != m_NextStream) {
rv = m_NextStream->OnDataAvailable(aURL, aStream, aLength);
/*
* Bump the refcount in case the stream gets destroyed while the data
* is being processed... If Stop(...) is called the stream could be
* freed prematurely :-(
*
* Currently this can happen if javascript loads a new URL
* (via nsIWebShell::LoadURL) during the parse phase...
*/
nsIStreamListener* listener = m_NextStream;
NS_ADDREF(listener);
rv = listener->OnDataAvailable(aURL, aStream, aLength);
NS_RELEASE(listener);
}
done: