From 9060ad1fce996ee2aed8aa834a58b959f49f6511 Mon Sep 17 00:00:00 2001 From: Randell Jesup Date: Thu, 10 Feb 2022 11:03:26 +0000 Subject: [PATCH] [Image] Image cleanup --- image/imgRequest.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/image/imgRequest.cpp b/image/imgRequest.cpp index ba99779d30..2a8af98cf4 100644 --- a/image/imgRequest.cpp +++ b/image/imgRequest.cpp @@ -96,6 +96,8 @@ imgRequest::Init(nsIURI *aURI, ReferrerPolicy aReferrerPolicy) { MOZ_ASSERT(NS_IsMainThread(), "Cannot use nsIURI off main thread!"); + // Init() can only be called once, and that's before it can be used off + // mainthread LOG_FUNC(gImgLog, "imgRequest::Init"); @@ -800,7 +802,14 @@ imgRequest::OnStopRequest(nsIRequest* aRequest, RefPtr strongThis = this; - if (mIsMultiPartChannel && mNewPartPending) { + bool isMultipart = false; + bool newPartPending = false; + { + MutexAutoLock lock(mMutex); + isMultipart = mIsMultiPartChannel; + newPartPending = mNewPartPending; + } + if (isMultipart && newPartPending) { OnDataAvailable(aRequest, ctxt, nullptr, 0, 0); }