From 13c78ceb25151b971e28f64d2ab931016eea7408 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 14 Aug 2018 16:20:34 +0200 Subject: pass SfxMedium around by std::unique_ptr Change-Id: Ibde7b68d9248f80d5304991390a80742265f37b3 Reviewed-on: https://gerrit.libreoffice.org/59031 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/source/ui/docshell/docsh4.cxx | 2 +- sc/source/ui/miscdlgs/instbdlg.cxx | 4 ++-- sc/source/ui/miscdlgs/linkarea.cxx | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'sc') diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 3d7b30aec367..155b6794eea6 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -2486,7 +2486,7 @@ IMPL_LINK( ScDocShell, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, void if ( ERRCODE_NONE == _pFileDlg->GetError() ) { sal_uInt16 nSlot = m_pImpl->pRequest->GetSlot(); - SfxMedium* pMed = m_pImpl->pDocInserter->CreateMedium(); + std::unique_ptr pMed = m_pImpl->pDocInserter->CreateMedium(); // #i87094# If a .odt was selected pMed is NULL. if (pMed) { diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx b/sc/source/ui/miscdlgs/instbdlg.cxx index 1c27d79e9398..381722983bab 100644 --- a/sc/source/ui/miscdlgs/instbdlg.cxx +++ b/sc/source/ui/miscdlgs/instbdlg.cxx @@ -305,7 +305,7 @@ IMPL_LINK( ScInsertTableDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg { if ( ERRCODE_NONE == _pFileDlg->GetError() ) { - SfxMedium* pMed = pDocInserter->CreateMedium(); + std::unique_ptr pMed = pDocInserter->CreateMedium(); if ( pMed ) { // ERRCTX_SFX_OPENDOC -> "Error loading document" @@ -321,7 +321,7 @@ IMPL_LINK( ScInsertTableDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg { weld::WaitObject aWait(m_xDialog.get()); - pDocShTables->DoLoad(pMed); + pDocShTables->DoLoad(pMed.release()); } ErrCode nErr = pDocShTables->GetErrorCode(); diff --git a/sc/source/ui/miscdlgs/linkarea.cxx b/sc/source/ui/miscdlgs/linkarea.cxx index 002bf482fd7e..e8eb369d39bc 100644 --- a/sc/source/ui/miscdlgs/linkarea.cxx +++ b/sc/source/ui/miscdlgs/linkarea.cxx @@ -179,7 +179,7 @@ IMPL_LINK( ScLinkedAreaDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, if ( _pFileDlg->GetError() != ERRCODE_NONE ) return; - SfxMedium* pMed = m_xDocInserter->CreateMedium(); + std::unique_ptr pMed = m_xDocInserter->CreateMedium(); if ( pMed ) { weld::WaitObject aWait(m_xDialog.get()); @@ -207,7 +207,7 @@ IMPL_LINK( ScLinkedAreaDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, m_pSourceShell = new ScDocShell; aSourceRef = m_pSourceShell; - m_pSourceShell->DoLoad( pMed ); + m_pSourceShell->DoLoad( pMed.get() ); ErrCode nErr = m_pSourceShell->GetErrorCode(); if (nErr) @@ -225,6 +225,7 @@ IMPL_LINK( ScLinkedAreaDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, m_xCbUrl->SetText(EMPTY_OUSTRING); } + pMed.release(); // DoLoad takes ownership } UpdateSourceRanges(); -- cgit