From 80c7aced0759970f833462766cc743c3a68ee66f Mon Sep 17 00:00:00 2001 From: Josh Aas Date: Mon, 9 Aug 2010 14:38:43 -0400 Subject: [PATCH] Bug 584143 - Crashes when streams are open and a plugin instance is closed at/under nsNPAPIPluginInstance::Stop, r=bsmedberg --- modules/plugin/base/src/nsNPAPIPluginInstance.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/plugin/base/src/nsNPAPIPluginInstance.cpp b/modules/plugin/base/src/nsNPAPIPluginInstance.cpp index 1c9ef3b46ac..5f6e48ad408 100644 --- a/modules/plugin/base/src/nsNPAPIPluginInstance.cpp +++ b/modules/plugin/base/src/nsNPAPIPluginInstance.cpp @@ -182,10 +182,11 @@ NS_IMETHODIMP nsNPAPIPluginInstance::Stop() OnPluginDestroy(&mNPP); // clean up open streams - for (unsigned int i = 0; i < mPStreamListeners.Length(); i++) { - mPStreamListeners[i]->CleanUpStream(NPRES_USER_BREAK); + while (mPStreamListeners.Length() > 0) { + nsRefPtr currentListener(mPStreamListeners[0]); + currentListener->CleanUpStream(NPRES_USER_BREAK); + mPStreamListeners.RemoveElement(currentListener); } - mPStreamListeners.Clear(); if (!mPlugin) return NS_ERROR_FAILURE;