Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: fpdfsdk/fpdfedit_embeddertest.cpp

Issue 2260683003: Fix an embedder test with leaked page object (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@fix
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | fpdfsdk/fsdk_baseform_embeddertest.cpp » ('j') | fpdfsdk/fsdk_baseform_embeddertest.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdfedit_embeddertest.cpp
diff --git a/fpdfsdk/fpdfedit_embeddertest.cpp b/fpdfsdk/fpdfedit_embeddertest.cpp
index 720dcdec019109457151e47fde672c8add8e592b..6edd0de868a2e325eefc0acab39bff7a2dd7476d 100644
--- a/fpdfsdk/fpdfedit_embeddertest.cpp
+++ b/fpdfsdk/fpdfedit_embeddertest.cpp
@@ -55,7 +55,7 @@ const char kExpectedPDF[] =
TEST_F(FPDFEditEmbeddertest, EmptyCreation) {
EXPECT_TRUE(CreateEmptyDocument());
- FPDF_PAGE page = FPDFPage_New(document(), 1, 640.0, 480.0);
+ FPDF_PAGE page = FPDFPage_New(document(), 0, 640.0, 480.0);
EXPECT_NE(nullptr, page);
EXPECT_TRUE(FPDFPage_GenerateContent(page));
EXPECT_TRUE(FPDF_SaveAsCopy(document(), this, 0));
@@ -66,5 +66,8 @@ TEST_F(FPDFEditEmbeddertest, EmptyCreation) {
std::replace(result.begin(), result.end(), '\0', '_');
EXPECT_THAT(result, testing::MatchesRegex(
std::string(kExpectedPDF, sizeof(kExpectedPDF))));
- FPDFPage_Delete(document(), 1);
+ // FPDFPage_New() doesn't add any new page into document if the page index is
Tom Sepez 2016/08/19 20:24:48 This comment should be in a public/ header file.
Wei Li 2016/08/19 22:25:27 Done.
+ // not within document's existing page range. Use FPDF_ClosePage() instead of
+ // FPDFPage_Delete() to free the page.
+ FPDF_ClosePage(page);
}
« no previous file with comments | « no previous file | fpdfsdk/fsdk_baseform_embeddertest.cpp » ('j') | fpdfsdk/fsdk_baseform_embeddertest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698