summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/doc_annot.cpp
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-07-11 14:43:40 -0700
committerCommit bot <commit-bot@chromium.org>2016-07-11 14:43:41 -0700
commit5a6c1398d0e559fb6a048cb0dca46ba9f9309a77 (patch)
tree40193eaf374d0f9bf2ec2f257871279b0f36efb8 /core/fpdfdoc/doc_annot.cpp
parentac14258c429141653f73ca5c1b64ad259ac15804 (diff)
downloadpdfium-5a6c1398d0e559fb6a048cb0dca46ba9f9309a77.tar.xz
Use smart pointers for class owned member variables
Replace raw member variables to smart pointer type to better maintain the ownership and to ease the management. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2136683002
Diffstat (limited to 'core/fpdfdoc/doc_annot.cpp')
-rw-r--r--core/fpdfdoc/doc_annot.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/core/fpdfdoc/doc_annot.cpp b/core/fpdfdoc/doc_annot.cpp
index 9b2f9e505f..fe17e9c811 100644
--- a/core/fpdfdoc/doc_annot.cpp
+++ b/core/fpdfdoc/doc_annot.cpp
@@ -41,7 +41,8 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
pAnnots->RemoveAt(i + 1);
pDict = pAnnots->GetDictAt(i);
}
- m_AnnotList.push_back(new CPDF_Annot(pDict, this));
+ m_AnnotList.push_back(
+ std::unique_ptr<CPDF_Annot>(new CPDF_Annot(pDict, this)));
if (bRegenerateAP && pDict->GetStringBy("Subtype") == "Widget" &&
CPDF_InterForm::UpdatingAPEnabled()) {
FPDF_GenerateAP(m_pDocument, pDict);
@@ -49,10 +50,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
}
}
-CPDF_AnnotList::~CPDF_AnnotList() {
- for (CPDF_Annot* annot : m_AnnotList)
- delete annot;
-}
+CPDF_AnnotList::~CPDF_AnnotList() {}
void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage,
CFX_RenderDevice* pDevice,
@@ -62,7 +60,7 @@ void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage,
FX_BOOL bWidgetPass,
CPDF_RenderOptions* pOptions,
FX_RECT* clip_rect) {
- for (CPDF_Annot* pAnnot : m_AnnotList) {
+ for (const auto& pAnnot : m_AnnotList) {
bool bWidget = pAnnot->GetSubType() == "Widget";
if ((bWidgetPass && !bWidget) || (!bWidgetPass && bWidget))
continue;