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 --- core/fxge/apple/fx_mac_imp.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'core/fxge/apple/fx_mac_imp.cpp') diff --git a/core/fxge/apple/fx_mac_imp.cpp b/core/fxge/apple/fx_mac_imp.cpp index 0b32083126..ced08d2776 100644 --- a/core/fxge/apple/fx_mac_imp.cpp +++ b/core/fxge/apple/fx_mac_imp.cpp @@ -5,12 +5,14 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include +#include #include "core/fxcrt/fx_codepage.h" #include "core/fxge/apple/apple_int.h" #include "core/fxge/cfx_gemodule.h" #include "core/fxge/ge/cfx_folderfontinfo.h" #include "core/fxge/ifx_systemfontinfo.h" +#include "third_party/base/ptr_util.h" namespace { @@ -122,11 +124,11 @@ void* CFX_MacFontInfo::MapFont(int weight, std::unique_ptr IFX_SystemFontInfo::CreateDefault( const char** pUnused) { - CFX_MacFontInfo* pInfo(new CFX_MacFontInfo); + auto pInfo = pdfium::MakeUnique(); pInfo->AddPath("~/Library/Fonts"); pInfo->AddPath("/Library/Fonts"); pInfo->AddPath("/System/Library/Fonts"); - return std::unique_ptr(pInfo); + return std::move(pInfo); } void CFX_GEModule::InitPlatform() { -- cgit v1.2.3