Index: ppapi/host/resource_message_handler.cc |
diff --git a/ppapi/host/resource_message_handler.cc b/ppapi/host/resource_message_handler.cc |
index 9442c1564a21022b29feff22e961bc4aecb7f94d..603d5e2538267b6e6a8b3e6599ace97cdc596626 100644 |
--- a/ppapi/host/resource_message_handler.cc |
+++ b/ppapi/host/resource_message_handler.cc |
@@ -22,6 +22,11 @@ void ResourceMessageHandler::RunMessageHandlerAndReply( |
const IPC::Message& msg, |
HostMessageContext* context) { |
ReplyMessageContext reply_context = context->MakeReplyMessageContext(); |
+ // CAUTION: Handling the message may cause the destruction of this object. |
+ // The message handler should ensure that if there is a chance that the |
+ // object will be destroyed, PP_OK_COMPLETIONPENDING is returned as the |
+ // result of the message handler. Otherwise the code below will attempt to |
+ // send a reply message on a destroyed object. |
reply_context.params.set_result(OnResourceMessageReceived(msg, context)); |
// Sanity check the resource handler. Note if the result was |