sw/source/core/doc/DocumentDeviceManager.cxx | 6 +++--- sw/source/core/inc/DocumentDeviceManager.hxx | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-)
New commits: commit e014ca57fdd40d4e6486cc105d3bb2b32b060b1a Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Wed Mar 28 10:28:25 2018 +0200 loplugin:useuniqueptr in DocumentDeviceManager Change-Id: I051f63173a7b58819d340b00ea237a4164b1dbad Reviewed-on: https://gerrit.libreoffice.org/52030 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx index f6b93727528b..52b1c9aa7a39 100644 --- a/sw/source/core/doc/DocumentDeviceManager.cxx +++ b/sw/source/core/doc/DocumentDeviceManager.cxx @@ -231,7 +231,7 @@ const SwPrintData & DocumentDeviceManager::getPrintData() const if(!mpPrtData) { DocumentDeviceManager * pThis = const_cast< DocumentDeviceManager * >(this); - pThis->mpPrtData = new SwPrintData; + pThis->mpPrtData.reset(new SwPrintData); // SwPrintData should be initialized from the configuration, // the respective config item is implemented by SwPrintOptions which @@ -248,13 +248,13 @@ const SwPrintData & DocumentDeviceManager::getPrintData() const void DocumentDeviceManager::setPrintData(/*[in]*/ const SwPrintData& rPrtData ) { if(!mpPrtData) - mpPrtData = new SwPrintData; + mpPrtData.reset(new SwPrintData); *mpPrtData = rPrtData; } DocumentDeviceManager::~DocumentDeviceManager() { - delete mpPrtData; + mpPrtData.reset(); mpVirDev.disposeAndClear(); mpPrt.disposeAndClear(); } diff --git a/sw/source/core/inc/DocumentDeviceManager.hxx b/sw/source/core/inc/DocumentDeviceManager.hxx index 1d5b48923541..23bb4e1f436f 100644 --- a/sw/source/core/inc/DocumentDeviceManager.hxx +++ b/sw/source/core/inc/DocumentDeviceManager.hxx @@ -22,6 +22,7 @@ #include <IDocumentDeviceAccess.hxx> #include <sal/types.h> #include <vcl/vclptr.hxx> +#include <memory> class SwDoc; class SfxPrinter; @@ -75,7 +76,7 @@ private: SwDoc& m_rDoc; VclPtr<SfxPrinter> mpPrt; VclPtr<VirtualDevice> mpVirDev; - SwPrintData* mpPrtData; + std::unique_ptr<SwPrintData> mpPrtData; }; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits