From df3b8e4ac64d30df8a419c96808618e373f55932 Mon Sep 17 00:00:00 2001 From: "sspitzer%netscape.com" Date: Fri, 28 Feb 2003 19:22:01 +0000 Subject: [PATCH] fix for bug #195440. crash when cancelling during downloading list of newsgroups in subscribe dialog. r/sr=darin git-svn-id: svn://10.0.0.236/trunk@138712 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/mailnews/news/src/nsNNTPProtocol.cpp | 46 +++++++++++--------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/mozilla/mailnews/news/src/nsNNTPProtocol.cpp b/mozilla/mailnews/news/src/nsNNTPProtocol.cpp index 114b40c3e74..231ceb51cb3 100644 --- a/mozilla/mailnews/news/src/nsNNTPProtocol.cpp +++ b/mozilla/mailnews/news/src/nsNNTPProtocol.cpp @@ -3328,7 +3328,10 @@ PRInt32 nsNNTPProtocol::ReadNewsList(nsIInputStream * inputStream, PRUint32 leng m_nextState = NEWS_FINISHED; // suspend necko request until timeout - m_request->Suspend(); + // might not have a request if someone called CloseSocket() + // see bug #195440 + if (m_request) + m_request->Suspend(); } PR_Free(lineToFree); @@ -3348,26 +3351,29 @@ nsNNTPProtocol::Notify(nsITimer *timer) void nsNNTPProtocol::TimerCallback() { - PR_LOG(NNTP,PR_LOG_ALWAYS,("nsNNTPProtocol::TimerCallback\n")); - m_nextState = NNTP_READ_LIST; - - // process whatever is already in the buffer at least once. - // - // NOTE: while downloading, it would almost be enough to just - // resume necko since it will call us again with data. however, - // if we are at the end of the data stream then we must call - // ProcessProtocolState since necko will not call us again. - // - // NOTE: this function may Suspend necko. Suspend is a reference - // counted (i.e., two suspends requires two resumes before the - // request will actually be resumed). - // - ProcessProtocolState(nsnull, mInputStream, 0,0); - - // resume necko request + PR_LOG(NNTP,PR_LOG_ALWAYS,("nsNNTPProtocol::TimerCallback\n")); + m_nextState = NNTP_READ_LIST; + + // process whatever is already in the buffer at least once. + // + // NOTE: while downloading, it would almost be enough to just + // resume necko since it will call us again with data. however, + // if we are at the end of the data stream then we must call + // ProcessProtocolState since necko will not call us again. + // + // NOTE: this function may Suspend necko. Suspend is a reference + // counted (i.e., two suspends requires two resumes before the + // request will actually be resumed). + // + ProcessProtocolState(nsnull, mInputStream, 0,0); + + // resume necko request + // might not have a request if someone called CloseSocket() + // see bug #195440 + if (m_request) m_request->Resume(); - - return; + + return; } /* start the xover command