| Index: ppapi/proxy/file_io_resource.cc
|
| diff --git a/ppapi/proxy/file_io_resource.cc b/ppapi/proxy/file_io_resource.cc
|
| index 76ee51c4e9ca01560bdc8bfcdde65c33117d587a..fc53fb052432c7124e039d0396a0d23b71ec219e 100644
|
| --- a/ppapi/proxy/file_io_resource.cc
|
| +++ b/ppapi/proxy/file_io_resource.cc
|
| @@ -111,9 +111,13 @@ int32_t FileIOResource::Open(PP_Resource file_ref,
|
| if (rv != PP_OK)
|
| return rv;
|
|
|
| + // Take a reference on the FileRef resource while we're opening the file; we
|
| + // don't want the plugin destroying it during the Open operation.
|
| + file_ref_ = enter.resource();
|
| +
|
| Call<PpapiPluginMsg_FileIO_OpenReply>(RENDERER,
|
| PpapiHostMsg_FileIO_Open(
|
| - enter.resource()->host_resource().host_resource(),
|
| + file_ref,
|
| open_flags),
|
| base::Bind(&FileIOResource::OnPluginMsgOpenFileComplete, this,
|
| callback));
|
| @@ -410,6 +414,9 @@ void FileIOResource::OnPluginMsgOpenFileComplete(
|
| const ResourceMessageReplyParams& params) {
|
| DCHECK(state_manager_.get_pending_operation() ==
|
| FileIOStateManager::OPERATION_EXCLUSIVE);
|
| +
|
| + // Release the FileRef resource.
|
| + file_ref_ = NULL;
|
| if (params.result() == PP_OK)
|
| state_manager_.SetOpenSucceed();
|
|
|
|
|