Bug 617152. Part 5: nsPluginHost::StopPluginInstance should skip plugin instances that are already destroyed (e.g. because the plugin was disabled). r=josh

This commit is contained in:
Robert O'Callahan 2010-12-20 14:37:43 +13:00
parent 6f3afc714b
commit 7faddbb34c
2 changed files with 8 additions and 3 deletions

View File

@ -109,6 +109,9 @@ public:
bool IsRunning() {
return RUNNING == mRunning;
}
bool HasStartedDestroying() {
return mRunning >= DESTROYING;
}
// Indicates whether the plugin is running normally or being shut down
bool CanFireNotifications() {

View File

@ -1218,7 +1218,7 @@ nsPluginHost::TagForPlugin(nsNPAPIPlugin* aPlugin)
}
}
// a plugin should never exist without a corresponding tag
NS_ASSERTION(PR_FALSE, "TagForPlugin has failed");
NS_ERROR("TagForPlugin has failed");
return nsnull;
}
@ -3209,9 +3209,11 @@ nsPluginHost::StopPluginInstance(nsIPluginInstance* aInstance)
PLUGIN_LOG(PLUGIN_LOG_NORMAL,
("nsPluginHost::StopPluginInstance called instance=%p\n",aInstance));
aInstance->Stop();
nsNPAPIPluginInstance* instance = static_cast<nsNPAPIPluginInstance*>(aInstance);
if (instance->HasStartedDestroying())
return NS_OK;
aInstance->Stop();
// if the plugin does not want to be 'cached' just remove it
PRBool doCache = PR_TRUE;