Bug 1285231 - Use Swap to move&empty plugins list before unloading - r?jwwang
MozReview-Commit-ID: LMkuOA0lBKD
--- a/dom/media/gmp/GMPServiceParent.cpp
+++ b/dom/media/gmp/GMPServiceParent.cpp
@@ -714,17 +714,17 @@ GeckoMediaPluginServiceParent::UnloadPlu
NS_LITERAL_CSTRING("Starting to unload plugins"));
#endif
nsTArray<RefPtr<GMPParent>> plugins;
{
MutexAutoLock lock(mMutex);
// Move all plugins references to a local array. This way mMutex won't be
// locked when calling CloseActive (to avoid inter-locking).
- plugins = Move(mPlugins);
+ Swap(plugins, mPlugins);
}
LOGD(("%s::%s plugins:%u including async:%u", __CLASS__, __FUNCTION__,
plugins.Length(), mAsyncShutdownPlugins.Length()));
#ifdef DEBUG
for (const auto& plugin : plugins) {
LOGD(("%s::%s plugin: '%s'", __CLASS__, __FUNCTION__,
plugin->GetDisplayName().get()));