diff options
-rw-r--r-- | chromium/pdf/pdfium/pdfium_engine.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/chromium/pdf/pdfium/pdfium_engine.cc b/chromium/pdf/pdfium/pdfium_engine.cc index 22cff050cfa..414f1265d8a 100644 --- a/chromium/pdf/pdfium/pdfium_engine.cc +++ b/chromium/pdf/pdfium/pdfium_engine.cc @@ -1343,9 +1343,15 @@ bool PDFiumEngine::HandleEvent(const pp::InputEvent& event) { DCHECK(defer_page_unload_); defer_page_unload_ = false; - for (int page_index : deferred_page_unloads_) + + // Store the pages to unload away because the act of unloading pages can cause + // there to be more pages to unload. We leave those extra pages to be unloaded + // on the next go around. + std::vector<int> pages_to_unload; + std::swap(pages_to_unload, deferred_page_unloads_); + for (int page_index : pages_to_unload) pages_[page_index]->Unload(); - deferred_page_unloads_.clear(); + return rv; } |