Skip to content

Commit

Permalink
Close a page after creating it
Browse files Browse the repository at this point in the history
FPDFPage_New creates a FPDF_PAGE object and adds a page to the FPDF_DOCUMENT.
However, the FPDF_PAGE object needs to be deleted by calling FPDF_ClosePage.

Bug: 807953
Change-Id: Ib0d7ca46979f855c38a03cf114c20505d825e620
Reviewed-on: https://chromium-review.googlesource.com/897930
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534057}
  • Loading branch information
npm1 authored and Commit Bot committed Feb 2, 2018
1 parent e3b83b4 commit f5c01eb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pdf/pdfium/pdfium_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2885,7 +2885,10 @@ void PDFiumEngine::AppendBlankPages(int num_pages) {
ConvertUnitDouble(page_rect.width(), kPixelsPerInch, kPointsPerInch);
double height_in_points =
ConvertUnitDouble(page_rect.height(), kPixelsPerInch, kPointsPerInch);
FPDFPage_New(doc_, i, width_in_points, height_in_points);
// Add a new page to the document, but delete the FPDF_PAGE object.
FPDF_PAGE temp_page =
FPDFPage_New(doc_, i, width_in_points, height_in_points);
FPDF_ClosePage(temp_page);
pages_.push_back(std::make_unique<PDFiumPage>(this, i, page_rect, true));
}

Expand Down

0 comments on commit f5c01eb

Please sign in to comment.