Index: pdf/pdfium/pdfium_engine.cc |
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc |
index 80f1fd6d9d709c33a890fb8064226b5e6979e3f1..f0ba08923cffe37077cd37b2bc7dfb4826c3be0a 100644 |
--- a/pdf/pdfium/pdfium_engine.cc |
+++ b/pdf/pdfium/pdfium_engine.cc |
@@ -12,6 +12,7 @@ |
#include <memory> |
#include <set> |
+#include "base/auto_reset.h" |
#include "base/i18n/encoding_detection.h" |
#include "base/i18n/icu_string_conversions.h" |
#include "base/lazy_instance.h" |
@@ -2470,9 +2471,8 @@ int PDFiumEngine::GetMostVisiblePage() { |
// to defer the page deletion otherwise we could potentially delete the page |
// that originated the calling JS request and destroy the objects that are |
// currently being used. |
- defer_page_unload_ = true; |
+ base::AutoReset<bool> defer_page_unload_guard(&defer_page_unload_, true); |
CalculateVisiblePages(); |
- defer_page_unload_ = false; |
return most_visible_page_; |
} |