Kaydet (Commit) b2f1bd73 authored tarafından Noel Grandin's avatar Noel Grandin

convert m_pDocContent in SwGlobalTree to unique_ptr

Change-Id: I779baa6dcad33aa5fbe49b5143b2b390a747036a
Reviewed-on: https://gerrit.libreoffice.org/64470
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst f3ba7596
......@@ -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;
......
......@@ -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();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment