From 6860ce9323207f8499f25c20f87b5ef960e8ed28 Mon Sep 17 00:00:00 2001 From: John Schoenick Date: Thu, 8 Nov 2012 18:29:37 -0800 Subject: [PATCH] Bug 766886 - Cleanup plugin streams earlier to avoid shutdown leak. r=bsmedberg --- dom/plugins/base/nsNPAPIPluginStreamListener.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/dom/plugins/base/nsNPAPIPluginStreamListener.cpp b/dom/plugins/base/nsNPAPIPluginStreamListener.cpp index aca8809ff077..d44a7614dfce 100644 --- a/dom/plugins/base/nsNPAPIPluginStreamListener.cpp +++ b/dom/plugins/base/nsNPAPIPluginStreamListener.cpp @@ -208,14 +208,17 @@ nsNPAPIPluginStreamListener::CleanUpStream(NPReason reason) // Seekable streams have an extra addref when they are created which must // be matched here. - if (NP_SEEK == mStreamType) + if (NP_SEEK == mStreamType && mStreamStarted) NS_RELEASE_THIS(); - + + if (mStreamListenerPeer) { + mStreamListenerPeer->CancelRequests(NS_BINDING_ABORTED); + mStreamListenerPeer = nullptr; + } + if (!mInst || !mInst->CanFireNotifications()) return rv; - mStreamListenerPeer = nullptr; - PluginDestructionGuard guard(mInst); nsNPAPIPlugin* plugin = mInst->GetPlugin(); @@ -280,7 +283,7 @@ nsNPAPIPluginStreamListener::CallURLNotify(NPReason reason) nsresult nsNPAPIPluginStreamListener::OnStartBinding(nsPluginStreamListenerPeer* streamPeer) { - if (!mInst || !mInst->CanFireNotifications()) + if (!mInst || !mInst->CanFireNotifications() || mStreamCleanedUp) return NS_ERROR_FAILURE; PluginDestructionGuard guard(mInst);