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

Unified Diff: fpdfsdk/pdfwindow/PWL_FontMap.cpp

Issue 2173253002: Use smart pointers for class owned pointers (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: fix release order 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
Index: fpdfsdk/pdfwindow/PWL_FontMap.cpp
diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/pdfwindow/PWL_FontMap.cpp
index 9192afd5e8e0549453e8991056faede4f39a013a..d7d1f448a055ff5a83040a973085de71c6d59a96 100644
--- a/fpdfsdk/pdfwindow/PWL_FontMap.cpp
+++ b/fpdfsdk/pdfwindow/PWL_FontMap.cpp
@@ -35,14 +35,11 @@ const char* const g_sDEStandardFontName[] = {"Courier",
} // namespace
CPWL_FontMap::CPWL_FontMap(CFX_SystemHandler* pSystemHandler)
- : m_pPDFDoc(nullptr), m_pSystemHandler(pSystemHandler) {
+ : m_pSystemHandler(pSystemHandler) {
ASSERT(m_pSystemHandler);
}
CPWL_FontMap::~CPWL_FontMap() {
- delete m_pPDFDoc;
- m_pPDFDoc = nullptr;
-
Empty();
}
@@ -53,12 +50,12 @@ void CPWL_FontMap::SetSystemHandler(CFX_SystemHandler* pSystemHandler) {
CPDF_Document* CPWL_FontMap::GetDocument() {
if (!m_pPDFDoc) {
if (CPDF_ModuleMgr::Get()) {
- m_pPDFDoc = new CPDF_Document(nullptr);
+ m_pPDFDoc.reset(new CPDF_Document(nullptr));
m_pPDFDoc->CreateNewDoc();
}
}
- return m_pPDFDoc;
+ return m_pPDFDoc.get();
}
CPDF_Font* CPWL_FontMap::GetPDFFont(int32_t nFontIndex) {

Powered by Google App Engine
This is Rietveld 408576698