Kaydet (Commit) e014ca57 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in DocumentDeviceManager

Change-Id: I051f63173a7b58819d340b00ea237a4164b1dbad
Reviewed-on: https://gerrit.libreoffice.org/52030Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 1d13418c
......@@ -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();
}
......
......@@ -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;
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment