diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-06 14:56:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-19 07:12:19 +0100 |
commit | e7d2ebe2fdb05ccdc742cc7c3d910880ba73ceef (patch) | |
tree | e28299fcbceea1c5255675754cd27d72ebc94910 | |
parent | 6e5d8bb2d60c2e44aa1d2bf7810bff09b9ceabb5 (diff) |
loplugin:useuniqueptr in SvxLineStyleToolBoxControl
Change-Id: I83e1536a1d45fffbf4fc5ddb611e382568ebf26c
Reviewed-on: https://gerrit.libreoffice.org/49934
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/svx/linectrl.hxx | 5 | ||||
-rw-r--r-- | svx/source/tbxctrls/linectrl.cxx | 8 |
2 files changed, 5 insertions, 8 deletions
diff --git a/include/svx/linectrl.hxx b/include/svx/linectrl.hxx index 2c476118d446..a2b1a484e18a 100644 --- a/include/svx/linectrl.hxx +++ b/include/svx/linectrl.hxx @@ -25,6 +25,7 @@ #include <sfx2/tbxctrl.hxx> #include <svx/svxdllapi.h> #include <svx/xtable.hxx> +#include <memory> class XLineStyleItem; class XLineDashItem; @@ -38,8 +39,8 @@ class SvxMetricField; class SVX_DLLPUBLIC SvxLineStyleToolBoxControl : public SfxToolBoxControl { private: - XLineStyleItem* pStyleItem; - XLineDashItem* pDashItem; + std::unique_ptr<XLineStyleItem> pStyleItem; + std::unique_ptr<XLineDashItem> pDashItem; bool bUpdate; diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx index d562abf9b4ca..4360b8155156 100644 --- a/svx/source/tbxctrls/linectrl.cxx +++ b/svx/source/tbxctrls/linectrl.cxx @@ -69,8 +69,6 @@ SvxLineStyleToolBoxControl::SvxLineStyleToolBoxControl( sal_uInt16 nSlotId, SvxLineStyleToolBoxControl::~SvxLineStyleToolBoxControl() { - delete pStyleItem; - delete pDashItem; } @@ -95,13 +93,11 @@ void SvxLineStyleToolBoxControl::StateChanged ( { if( nSID == SID_ATTR_LINE_STYLE ) { - delete pStyleItem; - pStyleItem = static_cast<XLineStyleItem*>(pState->Clone()); + pStyleItem.reset( static_cast<XLineStyleItem*>(pState->Clone()) ); } else if( nSID == SID_ATTR_LINE_DASH ) { - delete pDashItem; - pDashItem = static_cast<XLineDashItem*>(pState->Clone()); + pDashItem.reset( static_cast<XLineDashItem*>(pState->Clone()) ); } bUpdate = true; |