summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-07-24 11:31:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-07-25 08:47:37 +0200
commit36f8b5ec35440fa0b1dadadf28ce9d1a83f8dc50 (patch)
tree638d83ad378a27d9116da851378d7b647179665a
parent97c993b681bb059d1974b29ade5b433f93a85e46 (diff)
loplugin:useuniqueptr in SwSrcView
Change-Id: I550d184ddd158e32abc353f8f1d458319bd4c2c5 Reviewed-on: https://gerrit.libreoffice.org/57946 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/source/uibase/inc/srcview.hxx2
-rw-r--r--sw/source/uibase/uiview/srcview.cxx9
2 files changed, 5 insertions, 6 deletions
diff --git a/sw/source/uibase/inc/srcview.hxx b/sw/source/uibase/inc/srcview.hxx
index 298983510f4d..60b866371352 100644
--- a/sw/source/uibase/inc/srcview.hxx
+++ b/sw/source/uibase/inc/srcview.hxx
@@ -34,7 +34,7 @@ class SwSrcView: public SfxViewShell
{
VclPtr<SwSrcEditWindow> aEditWin;
- SvxSearchItem* pSearchItem;
+ std::unique_ptr<SvxSearchItem> pSearchItem;
bool bSourceSaved :1;
rtl_TextEncoding eLoadEncoding;
diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx
index 5aefb75da632..7160f1ec66cb 100644
--- a/sw/source/uibase/uiview/srcview.cxx
+++ b/sw/source/uibase/uiview/srcview.cxx
@@ -234,7 +234,7 @@ SwSrcView::~SwSrcView()
pDocShell->SetAutoLoad(INetURLObject(url), delay,
(delay != 0) || !url.isEmpty());
EndListening(*pDocShell);
- delete pSearchItem;
+ pSearchItem.reset();
aEditWin.disposeAndClear();
}
@@ -548,15 +548,14 @@ SvxSearchItem* SwSrcView::GetSearchItem()
{
if(!pSearchItem)
{
- pSearchItem = new SvxSearchItem(SID_SEARCH_ITEM);
+ pSearchItem.reset(new SvxSearchItem(SID_SEARCH_ITEM));
}
- return pSearchItem;
+ return pSearchItem.get();
}
void SwSrcView::SetSearchItem( const SvxSearchItem& rItem )
{
- delete pSearchItem;
- pSearchItem = static_cast<SvxSearchItem*>(rItem.Clone());
+ pSearchItem.reset(static_cast<SvxSearchItem*>(rItem.Clone()));
}
void SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem,