Index: ppapi/proxy/host_dispatcher.cc |
=================================================================== |
--- ppapi/proxy/host_dispatcher.cc (revision 103325) |
+++ ppapi/proxy/host_dispatcher.cc (working copy) |
@@ -134,11 +134,12 @@ |
TRACE_EVENT2("ppapi proxy", "HostDispatcher::Send", |
"Class", IPC_MESSAGE_ID_CLASS(msg->type()), |
"Line", IPC_MESSAGE_ID_LINE(msg->type())); |
- // Normal sync messages are set to unblock, which would normally cause the |
- // plugin to be reentered to process them. We only want to do this when we |
- // know the plugin is in a state to accept reentrancy. Since the plugin side |
- // never clears this flag on messages it sends, we can't get deadlock, but we |
- // may still get reentrancy in the host as a result. |
+ // Prevent the dispatcher from going away during the call. Scenarios |
+ // where this could happen include a Send for a sync message which while |
+ // waiting for the reply, dispatches an incoming ExecuteScript call which |
+ // destroys the plugin module and in turn the dispatcher, |
+ ScopedModuleReference ref(this); |
+ |
if (!allow_plugin_reentrancy_) |
msg->set_unblock(false); |
return Dispatcher::Send(msg); |