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

Unified Diff: xfa/fee/fde_txtedtengine.cpp

Issue 1960673003: Replace some calls to Release() with direct delete, part 1. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Add unique ptrs Created 4 years, 7 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: xfa/fee/fde_txtedtengine.cpp
diff --git a/xfa/fee/fde_txtedtengine.cpp b/xfa/fee/fde_txtedtengine.cpp
index 812817fbfa7fc86651013d3aa3ba9a4716308c68..dfbf02e88180fdcda3a81655684beb9ad6ef4e66 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)) {

Powered by Google App Engine
This is Rietveld 408576698