diff options
author | tsepez <tsepez@chromium.org> | 2016-05-11 10:26:05 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-11 10:26:05 -0700 |
commit | f74ad998d2e8d2636fb25e94823946a3b151e34e (patch) | |
tree | 0b18e0a29fdc4bf1cce66ea437d8a4841b3daf4a /xfa/fee/fde_txtedtengine.cpp | |
parent | 2c3a16a7698ba15476173e849f82c97ea3da9939 (diff) | |
download | pdfium-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/fee/fde_txtedtengine.cpp')
-rw-r--r-- | xfa/fee/fde_txtedtengine.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/xfa/fee/fde_txtedtengine.cpp b/xfa/fee/fde_txtedtengine.cpp index 812817fbfa..dfbf02e881 100644 --- a/xfa/fee/fde_txtedtengine.cpp +++ b/xfa/fee/fde_txtedtengine.cpp @@ -7,6 +7,7 @@ #include "xfa/fee/fde_txtedtengine.h" #include <algorithm> +#include <memory> #include "xfa/fde/tto/fde_textout.h" #include "xfa/fee/fde_txtedtparag.h" @@ -1488,7 +1489,7 @@ FX_BOOL CFDE_TxtEdtEngine::MoveEnd() { } FX_BOOL CFDE_TxtEdtEngine::IsFitArea(CFX_WideString& wsText) { - CFDE_TextOut* pTextOut = new CFDE_TextOut; + std::unique_ptr<CFDE_TextOut> pTextOut(new CFDE_TextOut); pTextOut->SetLineSpace(m_Param.fLineSpace); pTextOut->SetFont(m_Param.pFont); pTextOut->SetFontSize(m_Param.fFontSize); @@ -1507,7 +1508,6 @@ FX_BOOL CFDE_TxtEdtEngine::IsFitArea(CFX_WideString& wsText) { pTextOut->SetStyles(dwStyle); wsText += L"\n"; pTextOut->CalcLogicSize(wsText.c_str(), wsText.GetLength(), rcText); - pTextOut->Release(); wsText.Delete(wsText.GetLength() - 1); if ((m_Param.dwMode & FDE_TEXTEDITMODE_LimitArea_Horz) && (rcText.width > m_Param.fPlateWidth)) { |