diff options
author | raymes <raymes@chromium.org> | 2015-09-07 18:11:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-08 01:11:55 +0000 |
commit | cf7b9bfd81a7f2690c80deb46d35833acb692975 (patch) | |
tree | 315def80f8bb60b2d6ac2656b5c12649fae59bac /pdf/out_of_process_instance.cc | |
parent | a165fee74a7abdd037b87b968b4462f816611a53 (diff) | |
download | chromium_src-cf7b9bfd81a7f2690c80deb46d35833acb692975.zip chromium_src-cf7b9bfd81a7f2690c80deb46d35833acb692975.tar.gz chromium_src-cf7b9bfd81a7f2690c80deb46d35833acb692975.tar.bz2 |
Fix memory leak of PreviewModeClient in PDF
Previously, in print preview, we would construct a new PreviewModeClient and
pass it to the PDFEngine, however the PDFEngine does not maintain ownership
of the client passed in. Instead OutOfProcessInstance should maintain ownership
which is fixed by this CL.
BUG=522286
Review URL: https://codereview.chromium.org/1323943011
Cr-Commit-Position: refs/heads/master@{#347652}
Diffstat (limited to 'pdf/out_of_process_instance.cc')
-rw-r--r-- | pdf/out_of_process_instance.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc index 5f60a4b..2e62e8b 100644 --- a/pdf/out_of_process_instance.cc +++ b/pdf/out_of_process_instance.cc @@ -782,7 +782,8 @@ void OutOfProcessInstance::DidOpen(int32_t result) { void OutOfProcessInstance::DidOpenPreview(int32_t result) { if (result == PP_OK) { - preview_engine_.reset(PDFEngine::Create(new PreviewModeClient(this))); + preview_client_.reset(new PreviewModeClient(this)); + preview_engine_.reset(PDFEngine::Create(preview_client_.get())); preview_engine_->HandleDocumentLoad(embed_preview_loader_); } else { NOTREACHED(); |