diff options
Diffstat (limited to 'netwerk/base')
-rw-r--r-- | netwerk/base/nsTransportUtils.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/netwerk/base/nsTransportUtils.cpp b/netwerk/base/nsTransportUtils.cpp index df53ead198..242907da08 100644 --- a/netwerk/base/nsTransportUtils.cpp +++ b/netwerk/base/nsTransportUtils.cpp @@ -24,24 +24,21 @@ class nsTransportEventSinkProxy : public nsITransportEventSink { nsTransportEventSinkProxy(nsITransportEventSink* sink, nsIEventTarget* target) : mSink(sink), mTarget(target), - mLock("nsTransportEventSinkProxy.mLock"), - mLastEvent(nullptr) { - NS_ADDREF(mSink); - } + mLock("nsTransportEventSinkProxy.mLock") {} private: virtual ~nsTransportEventSinkProxy() { // our reference to mSink could be the last, so be sure to release // it on the target thread. otherwise, we could get into trouble. NS_ProxyRelease("nsTransportEventSinkProxy::mSink", mTarget, - dont_AddRef(mSink)); + mSink.forget()); } public: - nsITransportEventSink* mSink; + nsCOMPtr<nsITransportEventSink> mSink; nsCOMPtr<nsIEventTarget> mTarget; Mutex mLock MOZ_UNANNOTATED; - nsTransportStatusEvent* mLastEvent; + RefPtr<nsTransportStatusEvent> mLastEvent; }; class nsTransportStatusEvent : public Runnable { @@ -69,11 +66,14 @@ class nsTransportStatusEvent : public Runnable { // if not coalescing all, then last event may not equal self! { MutexAutoLock lock(mProxy->mLock); - if (mProxy->mLastEvent == this) mProxy->mLastEvent = nullptr; + if (mProxy->mLastEvent == this) { + mProxy->mLastEvent = nullptr; + } } mProxy->mSink->OnTransportStatus(mTransport, mStatus, mProgress, mProgressMax); + mProxy = nullptr; return NS_OK; } |