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: ...@@ -267,7 +267,7 @@ private:
SvTreeListEntry* m_pDDSource; // source for Drag'n Drop SvTreeListEntry* m_pDDSource; // source for Drag'n Drop
std::unique_ptr<SwGlblDocContents> m_pSwGlblDocContents; // array with sorted content 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; std::unique_ptr<sfx2::DocumentInserter> m_pDocInserter;
bool m_bIsInternalDrag :1; bool m_bIsInternalDrag :1;
......
...@@ -174,7 +174,6 @@ SwGlobalTree::SwGlobalTree(vcl::Window* pParent, SwNavigationPI* pDialog) ...@@ -174,7 +174,6 @@ SwGlobalTree::SwGlobalTree(vcl::Window* pParent, SwNavigationPI* pDialog)
, m_pActiveShell(nullptr) , m_pActiveShell(nullptr)
, m_pEmphasisEntry(nullptr) , m_pEmphasisEntry(nullptr)
, m_pDDSource(nullptr) , m_pDDSource(nullptr)
, m_pDocContent(nullptr)
, m_bIsInternalDrag(false) , m_bIsInternalDrag(false)
, m_bLastEntryEmphasis(false) , m_bLastEntryEmphasis(false)
{ {
...@@ -796,12 +795,11 @@ void SwGlobalTree::ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry ) ...@@ -796,12 +795,11 @@ void SwGlobalTree::ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry )
// If a RequestHelp is called during the dialogue, // If a RequestHelp is called during the dialogue,
// then the content gets lost. Because of that a copy // then the content gets lost. Because of that a copy
// is created in which only the DocPos is set correctly. // is created in which only the DocPos is set correctly.
SwGlblDocContent* pContCopy = nullptr; std::unique_ptr<SwGlblDocContent> pContCopy;
if(pCont) if(pCont)
pContCopy = new SwGlblDocContent(pCont->GetDocPos()); pContCopy.reset(new SwGlblDocContent(pCont->GetDocPos()));
SfxDispatcher& rDispatch = *m_pActiveShell->GetView().GetViewFrame()->GetDispatcher(); SfxDispatcher& rDispatch = *m_pActiveShell->GetView().GetViewFrame()->GetDispatcher();
sal_uInt16 nSlot = 0; sal_uInt16 nSlot = 0;
bool bDeleteContentCopy = true;
switch( nSelectedPopupEntry ) switch( nSelectedPopupEntry )
{ {
case CTX_UPDATE_SEL: case CTX_UPDATE_SEL:
...@@ -925,9 +923,8 @@ void SwGlobalTree::ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry ) ...@@ -925,9 +923,8 @@ void SwGlobalTree::ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry )
break; break;
case CTX_INSERT_FILE: case CTX_INSERT_FILE:
{ {
bDeleteContentCopy = false; m_pDocContent = std::move(pContCopy);
m_pDocContent = pContCopy; InsertRegion( m_pDocContent.get() );
InsertRegion( pContCopy );
pCont = nullptr; pCont = nullptr;
} }
break; break;
...@@ -1016,8 +1013,6 @@ void SwGlobalTree::ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry ) ...@@ -1016,8 +1013,6 @@ void SwGlobalTree::ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry )
rDispatch.Execute(nSlot); rDispatch.Execute(nSlot);
if(Update( false )) if(Update( false ))
Display(); Display();
if ( bDeleteContentCopy )
delete pContCopy;
} }
IMPL_LINK_NOARG(SwGlobalTree, Timeout, Timer *, void) IMPL_LINK_NOARG(SwGlobalTree, Timeout, Timer *, void)
...@@ -1376,8 +1371,8 @@ IMPL_LINK( SwGlobalTree, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, vo ...@@ -1376,8 +1371,8 @@ IMPL_LINK( SwGlobalTree, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, vo
pFileNames[nPos++] = sFileName; pFileNames[nPos++] = sFileName;
} }
pMedList.reset(); pMedList.reset();
InsertRegion( m_pDocContent, aFileNames ); InsertRegion( m_pDocContent.get(), aFileNames );
DELETEZ( m_pDocContent ); 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