From 93d081110279c309433a397bfba71b46533a710d Mon Sep 17 00:00:00 2001 From: Bo Xu Date: Tue, 19 Aug 2014 17:17:04 -0700 Subject: Fix bug in CPDF_PageContentGenerate constructor and destructor m_pageObjects never gets initialize, thus making CPDF_PageContentGenerate::GenerateContent() doing nothing. Since the CPFD_PageObject are owned by m_pPage, no need to release them in the destructor. BUG=385119 R=thestig@chromium.org, vitalybuka@chromium.org Review URL: https://codereview.chromium.org/470253004 --- core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp index e33a99ba63..e8c051b434 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../../include/fpdfapi/fpdf_page.h" @@ -20,15 +20,13 @@ CPDF_PageContentGenerate::CPDF_PageContentGenerate(CPDF_Page* pPage) : m_pPage(p if (m_pPage) { m_pDocument = m_pPage->m_pDocument; } + FX_POSITION pos = pPage->GetFirstObjectPosition(); + while (pos) { + InsertPageObject(pPage->GetNextObject(pos)); + } } CPDF_PageContentGenerate::~CPDF_PageContentGenerate() { - for (int i = 0; i < m_pageObjects.GetSize(); ++i) { - CPDF_PageObject* pPageObj = (CPDF_PageObject*)m_pageObjects[i]; - if (pPageObj) { - pPageObj->Release(); - } - } } FX_BOOL CPDF_PageContentGenerate::InsertPageObject(CPDF_PageObject* pPageObject) { -- cgit v1.2.3