summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-09-15 17:16:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-09-18 09:07:45 +0200
commit83b840e6a08d7d990a4703b6ef67c3829c75aad4 (patch)
tree9b743bba037bbc7e1bbb6e91994686b83c27ec7b
parent7e4e715ea3a05bbcbba78c8deaa0b339dfa42926 (diff)
loplugin:useuniqueptr in SwXTextDocument
Change-Id: I095e0b35d62fa0c82e7e171b2923431e06175558 Reviewed-on: https://gerrit.libreoffice.org/60614 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/inc/unotxdoc.hxx2
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx11
2 files changed, 5 insertions, 8 deletions
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index d0ead1913fc1..0636dbfd5007 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -133,7 +133,7 @@ private:
class Impl;
::sw::UnoImplPtr<Impl> m_pImpl;
- std::deque<UnoActionContext*> aActionArr;
+ std::deque<std::unique_ptr<UnoActionContext>> maActionArr;
const SfxItemPropertySet* pPropSet;
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 369df2b014ed..0446bf4bac7c 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -545,25 +545,22 @@ void SwXTextDocument::lockControllers()
if(!IsValid())
throw DisposedException("", static_cast< XTextDocument* >(this));
- UnoActionContext* pContext = new UnoActionContext(pDocShell->GetDoc());
- aActionArr.push_front(pContext);
+ maActionArr.emplace_front(new UnoActionContext(pDocShell->GetDoc()));
}
void SwXTextDocument::unlockControllers()
{
SolarMutexGuard aGuard;
- if(aActionArr.empty())
+ if(maActionArr.empty())
throw RuntimeException("Nothing to unlock");
- UnoActionContext* pContext = aActionArr.front();
- aActionArr.pop_front();
- delete pContext;
+ maActionArr.pop_front();
}
sal_Bool SwXTextDocument::hasControllersLocked()
{
SolarMutexGuard aGuard;
- return !aActionArr.empty();
+ return !maActionArr.empty();
}
Reference< frame::XController > SwXTextDocument::getCurrentController()