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

Unified Diff: core/fpdfdoc/cpdf_annot.cpp

Issue 2189463003: Use smart pointer for CPDF_Form in CPDF_Annot. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 5 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 | « core/fpdfdoc/cpdf_annot.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfdoc/cpdf_annot.cpp
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index dcdd89c3f4ade2211d928f00173838fddd250433..57e7bc0bbb5a3dcfecaf7fe29a219d307736d4a7 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -12,6 +12,7 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
#include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h"
#include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h"
+#include "core/fxcrt/include/fx_memory.h"
#include "core/fxge/include/fx_ge.h"
CPDF_Annot::CPDF_Annot(CPDF_Dictionary* pDict, CPDF_Document* pDocument)
@@ -24,9 +25,6 @@ CPDF_Annot::~CPDF_Annot() {
}
void CPDF_Annot::ClearCachedAP() {
- for (const auto& pair : m_APMap) {
- delete pair.second;
- }
m_APMap.clear();
}
CFX_ByteString CPDF_Annot::GetSubType() const {
@@ -90,12 +88,12 @@ CPDF_Form* CPDF_Annot::GetAPForm(const CPDF_Page* pPage, AppearanceMode mode) {
auto it = m_APMap.find(pStream);
if (it != m_APMap.end())
- return it->second;
+ return it->second.get();
CPDF_Form* pNewForm =
new CPDF_Form(m_pDocument, pPage->m_pResources, pStream);
pNewForm->ParseContent(nullptr, nullptr, nullptr);
- m_APMap[pStream] = pNewForm;
+ m_APMap[pStream] = WrapUnique(pNewForm);
return pNewForm;
}
« no previous file with comments | « core/fpdfdoc/cpdf_annot.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698