summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-12-03 15:44:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-12-04 07:13:20 +0100
commitb2f1bd73f96724031edcf78320c51747a339b5e2 (patch)
tree086ae9ac04c0bbd861f601240d4d6369d4a8b1b4 /sw
parentf3ba759663b85381cf5abeaeee8ffa2c7ca59bc5 (diff)
convert m_pDocContent in SwGlobalTree to unique_ptr
Change-Id: I779baa6dcad33aa5fbe49b5143b2b390a747036a Reviewed-on: https://gerrit.libreoffice.org/64470 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/inc/conttree.hxx2
-rw-r--r--sw/source/uibase/utlui/glbltree.cxx17
2 files changed, 7 insertions, 12 deletions
diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx
index 98ce484e830d..2d8354607dca 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -267,7 +267,7 @@ private:
SvTreeListEntry* m_pDDSource; // source for Drag'n Drop
std::unique_ptr<SwGlblDocContents> m_pSwGlblDocContents; // array with sorted content
- SwGlblDocContent* m_pDocContent;
+ std::unique_ptr<SwGlblDocContent> m_pDocContent;
std::unique_ptr<sfx2::DocumentInserter> m_pDocInserter;
bool m_bIsInternalDrag :1;
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index 5593709267ca..275f71578aae 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -174,7 +174,6 @@ SwGlobalTree::SwGlobalTree(vcl::Window* pParent, SwNavigationPI* pDialog)
, m_pActiveShell(nullptr)
, m_pEmphasisEntry(nullptr)
, m_pDDSource(nullptr)
- , m_pDocContent(nullptr)
, m_bIsInternalDrag(false)
, m_bLastEntryEmphasis(false)
{
@@ -796,12 +795,11 @@ void SwGlobalTree::ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry )
// If a RequestHelp is called during the dialogue,
// then the content gets lost. Because of that a copy
// is created in which only the DocPos is set correctly.
- SwGlblDocContent* pContCopy = nullptr;
+ std::unique_ptr<SwGlblDocContent> pContCopy;
if(pCont)
- pContCopy = new SwGlblDocContent(pCont->GetDocPos());
+ pContCopy.reset(new SwGlblDocContent(pCont->GetDocPos()));
SfxDispatcher& rDispatch = *m_pActiveShell->GetView().GetViewFrame()->GetDispatcher();
sal_uInt16 nSlot = 0;
- bool bDeleteContentCopy = true;
switch( nSelectedPopupEntry )
{
case CTX_UPDATE_SEL:
@@ -925,9 +923,8 @@ void SwGlobalTree::ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry )
break;
case CTX_INSERT_FILE:
{
- bDeleteContentCopy = false;
- m_pDocContent = pContCopy;
- InsertRegion( pContCopy );
+ m_pDocContent = std::move(pContCopy);
+ InsertRegion( m_pDocContent.get() );
pCont = nullptr;
}
break;
@@ -1016,8 +1013,6 @@ void SwGlobalTree::ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry )
rDispatch.Execute(nSlot);
if(Update( false ))
Display();
- if ( bDeleteContentCopy )
- delete pContCopy;
}
IMPL_LINK_NOARG(SwGlobalTree, Timeout, Timer *, void)
@@ -1376,8 +1371,8 @@ IMPL_LINK( SwGlobalTree, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, vo
pFileNames[nPos++] = sFileName;
}
pMedList.reset();
- InsertRegion( m_pDocContent, aFileNames );
- DELETEZ( m_pDocContent );
+ InsertRegion( m_pDocContent.get(), aFileNames );
+ m_pDocContent.reset();
}
}