mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
Fixed random crash...
This commit is contained in:
parent
b3a77e866c
commit
c71fa4e0f4
@ -182,12 +182,6 @@ ImageConsumer::OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRInt32 l
|
||||
{
|
||||
PRInt32 max_read;
|
||||
PRInt32 bytes_read = 0, str_length;
|
||||
|
||||
// If we previously held onto a stream, drop our reference
|
||||
if (mStream != nsnull) {
|
||||
NS_RELEASE(mStream);
|
||||
}
|
||||
|
||||
ilINetReader *reader = mURL->GetReader();
|
||||
|
||||
if (mInterrupted || mStatus != 0) {
|
||||
@ -247,8 +241,12 @@ ImageConsumer::OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRInt32 l
|
||||
// If we haven't emptied the stream, hold onto it, because
|
||||
// we will need to read from it subsequently and we don't
|
||||
// know if we'll get a OnDataAvailable call again.
|
||||
//
|
||||
// Addref the new stream before releasing the old one,
|
||||
// in case it is the same stream!
|
||||
NS_ADDREF(pIStream);
|
||||
NS_IF_RELEASE(mStream);
|
||||
mStream = pIStream;
|
||||
NS_ADDREF(mStream);
|
||||
}
|
||||
|
||||
NS_RELEASE(reader);
|
||||
|
Loading…
Reference in New Issue
Block a user