summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app/xfa_fwltheme.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-05-11 10:26:05 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-11 10:26:05 -0700
commitf74ad998d2e8d2636fb25e94823946a3b151e34e (patch)
tree0b18e0a29fdc4bf1cce66ea437d8a4841b3daf4a /xfa/fxfa/app/xfa_fwltheme.cpp
parent2c3a16a7698ba15476173e849f82c97ea3da9939 (diff)
downloadpdfium-f74ad998d2e8d2636fb25e94823946a3b151e34e.tar.xz
Replace some calls to Release() with direct delete, part 1.
Searching for the anti-pattern: void Release() { delete this; } We must be explicit on the ownership model. Add unique_ptrs as a result. Review-Url: https://codereview.chromium.org/1960673003
Diffstat (limited to 'xfa/fxfa/app/xfa_fwltheme.cpp')
-rw-r--r--xfa/fxfa/app/xfa_fwltheme.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp
index fac873cac9..df09fb504a 100644
--- a/xfa/fxfa/app/xfa_fwltheme.cpp
+++ b/xfa/fxfa/app/xfa_fwltheme.cpp
@@ -44,7 +44,6 @@ CXFA_FFWidget* XFA_ThemeGetOuterWidget(IFWL_Widget* pWidget) {
return NULL;
}
CXFA_FWLTheme::CXFA_FWLTheme(CXFA_FFApp* pApp) : m_pApp(pApp) {
- m_pTextOut = NULL;
m_dwCapacity = 0;
m_fCapacity = 0;
m_pCalendarFont = NULL;
@@ -77,7 +76,7 @@ CXFA_FWLTheme::~CXFA_FWLTheme() {
delete m_pBarcodeTP;
}
FWL_Error CXFA_FWLTheme::Initialize() {
- m_pTextOut = new CFDE_TextOut;
+ m_pTextOut.reset(new CFDE_TextOut);
for (size_t i = 0; !m_pCalendarFont && i < FX_ArraySize(g_FWLTheme_CalFonts);
++i) {
m_pCalendarFont = IFX_Font::LoadFont(g_FWLTheme_CalFonts[i], 0, 0,
@@ -98,13 +97,10 @@ FWL_Error CXFA_FWLTheme::Initialize() {
return FWL_Error::Succeeded;
}
FWL_Error CXFA_FWLTheme::Finalize() {
- if (m_pTextOut) {
- m_pTextOut->Release();
- m_pTextOut = NULL;
- }
+ m_pTextOut.reset();
if (m_pCalendarFont) {
m_pCalendarFont->Release();
- m_pCalendarFont = NULL;
+ m_pCalendarFont = nullptr;
}
FWLTHEME_Release();
return FWL_Error::Succeeded;
@@ -386,8 +382,6 @@ FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) {
m_pTextOut->SetTextColor(pAcc->GetTextColor());
if (!pParams)
return FALSE;
- if (!m_pTextOut)
- return FALSE;
m_pTextOut->SetAlignment(pParams->m_iTTOAlign);
m_pTextOut->SetStyles(pParams->m_dwTTOStyles);
m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(),