summaryrefslogtreecommitdiff
path: root/xfa/fwl/basewidget/fwl_editimp.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/fwl/basewidget/fwl_editimp.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/fwl/basewidget/fwl_editimp.cpp')
-rw-r--r--xfa/fwl/basewidget/fwl_editimp.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp
index e47fb1b739..9f80336efa 100644
--- a/xfa/fwl/basewidget/fwl_editimp.cpp
+++ b/xfa/fwl/basewidget/fwl_editimp.cpp
@@ -7,6 +7,7 @@
#include "xfa/fwl/basewidget/fwl_editimp.h"
#include <algorithm>
+#include <memory>
#include <vector>
#include "xfa/fde/fde_gedevice.h"
@@ -1082,13 +1083,13 @@ void CFWL_EditImp::DrawContent(CFX_Graphics* pGraphics,
CFX_RenderDevice* pRenderDev = pGraphics->GetRenderDevice();
if (!pRenderDev)
return;
- CFDE_RenderDevice* pRenderDevice = new CFDE_RenderDevice(pRenderDev, FALSE);
- CFDE_RenderContext* pRenderContext = new CFDE_RenderContext;
+
+ std::unique_ptr<CFDE_RenderDevice> pRenderDevice(
+ new CFDE_RenderDevice(pRenderDev, FALSE));
+ std::unique_ptr<CFDE_RenderContext> pRenderContext(new CFDE_RenderContext);
pRenderDevice->SetClipRect(rtClip);
- pRenderContext->StartRender(pRenderDevice, pPage, mt);
- pRenderContext->DoRender(NULL);
- pRenderContext->Release();
- pRenderDevice->Release();
+ pRenderContext->StartRender(pRenderDevice.get(), pPage, mt);
+ pRenderContext->DoRender(nullptr);
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_CombText) {
pGraphics->RestoreGraphState();
CFX_Path path;
@@ -1110,6 +1111,7 @@ void CFWL_EditImp::DrawContent(CFX_Graphics* pGraphics,
}
pGraphics->RestoreGraphState();
}
+
void CFWL_EditImp::UpdateEditEngine() {
UpdateEditParams();
UpdateEditLayout();