From 06185186a77336f12452840046e161dad7ea851a Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Tue, 3 Dec 2013 09:02:07 -0500 Subject: [PATCH] Bug 944854 - Avoid triggering harmless assertion on PeerConnectionObserver weakref. r=abr --- .../signaling/src/peerconnection/PeerConnectionImpl.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index 128eda87382..b54a322074a 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -992,15 +992,18 @@ PeerConnectionImpl::CreateDataChannel(const nsAString& aLabel, // Without it, each weak-ref call in this file would look like this: // // nsCOMPtr tmp = do_QueryReferent(mPCObserver); -// nsRefPtr tmp2 = do_QueryObject(tmp); -// nsRefPtr pco = static_cast(&*tmp2); -// if (!pco) { +// if (!tmp) { // return; // } +// nsRefPtr tmp2 = do_QueryObject(tmp); +// nsRefPtr pco = static_cast(&*tmp2); static already_AddRefed do_QueryObjectReferent(nsIWeakReference* aRawPtr) { nsCOMPtr tmp = do_QueryReferent(aRawPtr); + if (!tmp) { + return nullptr; + } nsRefPtr tmp2 = do_QueryObject(tmp); nsRefPtr tmp3 = static_cast(&*tmp2); return tmp3.forget();