From fe91c6c8211cec39f871d9202556e1957bf81983 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 16 May 2017 15:33:20 -0700 Subject: Be skeptical of bare |new|s. In particular, prefer an explicit .release() call when handing ownership of an object to a caller across a C-API. Change-Id: Ic3784e9d0b2d378a08d388989eaea7c9166bacd1 Reviewed-on: https://pdfium-review.googlesource.com/5470 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- fpdfsdk/cpdfsdk_annothandlermgr.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'fpdfsdk/cpdfsdk_annothandlermgr.cpp') diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp index 287ee11a4d..7ea301c0e4 100644 --- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp +++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp @@ -17,6 +17,7 @@ #include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_pageview.h" #include "fpdfsdk/cpdfsdk_widgethandler.h" +#include "third_party/base/ptr_util.h" #ifdef PDF_ENABLE_XFA #include "fpdfsdk/cpdfsdk_xfawidgethandler.h" @@ -27,10 +28,11 @@ CPDFSDK_AnnotHandlerMgr::CPDFSDK_AnnotHandlerMgr( CPDFSDK_FormFillEnvironment* pFormFillEnv) - : m_pBAAnnotHandler(new CPDFSDK_BAAnnotHandler()), - m_pWidgetHandler(new CPDFSDK_WidgetHandler(pFormFillEnv)), + : m_pBAAnnotHandler(pdfium::MakeUnique()), + m_pWidgetHandler(pdfium::MakeUnique(pFormFillEnv)), #ifdef PDF_ENABLE_XFA - m_pXFAWidgetHandler(new CPDFSDK_XFAWidgetHandler(pFormFillEnv)), + m_pXFAWidgetHandler( + pdfium::MakeUnique(pFormFillEnv)), #endif // PDF_ENABLE_XFA m_pFormFillEnv(pFormFillEnv) { m_pWidgetHandler->SetFormFiller(m_pFormFillEnv->GetInteractiveFormFiller()); -- cgit v1.2.3