some bulletproofing code. I got a random crash here (sorry, I lost the stack) because the

downstreamlister was null.  trying to reproduce.  at least now it will only assert.
r=mscott
This commit is contained in:
sspitzer%netscape.com 2000-02-05 01:20:09 +00:00
Родитель 4f8d8e455f
Коммит b6b2110427
1 изменённых файлов: 15 добавлений и 3 удалений

18
netwerk/cache/memcache/nsMemCacheChannel.cpp поставляемый
Просмотреть файл

@ -119,7 +119,13 @@ public:
NS_IMETHOD
OnStartRequest(nsIChannel *channel, nsISupports *aContext) {
nsresult rv;
rv = mDownstreamListener->OnStartRequest(mChannel, aContext);
NS_ASSERTION(mDownstreamListener, "no downstream listener");
if (mDownstreamListener) {
rv = mDownstreamListener->OnStartRequest(mChannel, aContext);
}
if (NS_FAILED(rv))
Cancel();
return rv;
@ -129,8 +135,14 @@ public:
OnStopRequest(nsIChannel *channel, nsISupports *aContext,
nsresult status, const PRUnichar *errorMsg) {
nsresult rv;
rv = mDownstreamListener->OnStopRequest(mChannel, aContext, status, errorMsg);
mDownstreamListener = 0;
NS_ASSERTION(mDownstreamListener, "no downstream listener");
if (mDownstreamListener) {
rv = mDownstreamListener->OnStopRequest(mChannel, aContext, status, errorMsg);
mDownstreamListener = 0;
}
// Tricky: causes this instance to be free'ed because mEventQueueStreamListener
// has a circular reference back to this.
mEventQueueStreamListener = 0;