loplugin:useuniqueptr in basctl::CheckBox

Change-Id: Iec9a0f39b3853108bdb5218e7480a09b261198ec
Reviewed-on: https://gerrit.libreoffice.org/54846
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2018-05-17 15:32:38 +02:00
parent 4b5699bff5
commit 7fd67ca936
2 changed files with 5 additions and 6 deletions

View File

@@ -166,8 +166,7 @@ CheckBox::~CheckBox()
void CheckBox::dispose()
{
delete pCheckButton;
pCheckButton = nullptr;
pCheckButton.reset();
// delete user data
SvTreeListEntry* pEntry = First();
@@ -182,10 +181,10 @@ void CheckBox::dispose()
void CheckBox::Init()
{
pCheckButton = new SvLBoxButtonData(this);
pCheckButton.reset(new SvLBoxButtonData(this));
if (eMode == ObjectMode::Library)
EnableCheckButton( pCheckButton );
EnableCheckButton( pCheckButton.get() );
else
EnableCheckButton( nullptr );
@@ -197,7 +196,7 @@ void CheckBox::SetMode (ObjectMode e)
eMode = e;
if (eMode == ObjectMode::Library)
EnableCheckButton( pCheckButton );
EnableCheckButton( pCheckButton.get() );
else
EnableCheckButton( nullptr );
}

View File

@@ -111,7 +111,7 @@ class CheckBox : public SvTabListBox
{
private:
ObjectMode eMode;
SvLBoxButtonData* pCheckButton;
std::unique_ptr<SvLBoxButtonData> pCheckButton;
ScriptDocument m_aDocument;
void Init();