From f74ad998d2e8d2636fb25e94823946a3b151e34e Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 11 May 2016 10:26:05 -0700 Subject: 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 --- xfa/fde/fde_render.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'xfa/fde/fde_render.h') diff --git a/xfa/fde/fde_render.h b/xfa/fde/fde_render.h index c28b4abd16..1a80bce926 100644 --- a/xfa/fde/fde_render.h +++ b/xfa/fde/fde_render.h @@ -7,6 +7,8 @@ #ifndef XFA_FDE_FDE_RENDER_H_ #define XFA_FDE_FDE_RENDER_H_ +#include + #include "core/fxcrt/include/fx_coordinates.h" #include "xfa/fde/fde_gedevice.h" #include "xfa/fde/fde_iterator.h" @@ -24,9 +26,8 @@ enum FDE_RENDERSTATUS { class CFDE_RenderContext : public CFX_Target { public: CFDE_RenderContext(); - ~CFDE_RenderContext(); + ~CFDE_RenderContext() override; - void Release() { delete this; } FX_BOOL StartRender(CFDE_RenderDevice* pRenderDevice, IFDE_CanvasSet* pCanvasSet, const CFX_Matrix& tmDoc2Device); @@ -42,11 +43,11 @@ class CFDE_RenderContext : public CFX_Target { protected: FDE_RENDERSTATUS m_eStatus; CFDE_RenderDevice* m_pRenderDevice; - CFDE_Brush* m_pBrush; CFX_Matrix m_Transform; FXTEXT_CHARPOS* m_pCharPos; int32_t m_iCharPosCount; - CFDE_VisualSetIterator* m_pIterator; + std::unique_ptr m_pBrush; + std::unique_ptr m_pIterator; }; #endif // XFA_FDE_FDE_RENDER_H_ -- cgit v1.2.3