Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8011)

Unified Diff: chrome/plugin/plugin_channel.cc

Issue 258026: Fix scripting during NPP_Destroy. Note that if the plugin is making a call t... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/plugin/plugin_channel.cc
===================================================================
--- chrome/plugin/plugin_channel.cc (revision 28004)
+++ chrome/plugin/plugin_channel.cc (working copy)
@@ -222,11 +222,18 @@
IPC::Message* reply_msg) {
for (size_t i = 0; i < plugin_stubs_.size(); ++i) {
if (plugin_stubs_[i]->instance_id() == instance_id) {
- filter_->ReleaseModalDialogEvent(
- plugin_stubs_[i]->webplugin()->containing_window());
+ scoped_refptr<MessageFilter> filter(filter_);
+ gfx::NativeViewId window =
+ plugin_stubs_[i]->webplugin()->containing_window();
plugin_stubs_.erase(plugin_stubs_.begin() + i);
+ Send(reply_msg);
RemoveRoute(instance_id);
- Send(reply_msg);
jam 2009/10/06 07:10:48 note: this was using *this* object after RemoveRou
+ // NOTE: *this* might be deleted as a result of calling RemoveRoute.
+ // Don't release the modal dialog event right away, but do it after the
+ // stack unwinds since the plugin can be destroyed later if it's in use
+ // right now.
+ MessageLoop::current()->PostNonNestableTask(FROM_HERE, NewRunnableMethod(
+ filter.get(), &MessageFilter::ReleaseModalDialogEvent, window));
return;
}
}

Powered by Google App Engine
This is Rietveld 408576698