summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-09-22 17:03:32 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-09-23 22:28:18 +0200
commitf18106b4cb120af673e39c89f661fe6bc6db6a2c (patch)
tree09cdd3dfc8acb6468329e2ab39c506630e8a5f80
parent40287a71f8be03ba2fefc8500509bb37c74cd5b4 (diff)
coverity#1401334 Uncaught exception
Change-Id: Id6dad66b3c55e5b3049f57e65c857db5abce50b1 Reviewed-on: https://gerrit.libreoffice.org/60901 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/inc/docsh.hxx5
-rw-r--r--sw/inc/shellio.hxx3
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx2
-rw-r--r--sw/source/uibase/app/docsh.cxx6
-rw-r--r--sw/source/uibase/app/docsh2.cxx2
-rw-r--r--sw/source/uibase/uiview/view2.cxx2
6 files changed, 12 insertions, 8 deletions
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index 21344ca76cf7..e3d4e352ad1b 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -30,8 +30,8 @@
#include "shellid.hxx"
#include <svl/lstner.hxx>
-
#include <sfx2/StyleManager.hxx>
+#include <o3tl/deleter.hxx>
class SwDoc;
class SfxDocumentInfoDialog;
@@ -43,6 +43,7 @@ class SwWrtShell;
class SwFEShell;
class Reader;
class SwReader;
+typedef std::unique_ptr<SwReader, o3tl::default_delete<SwReader>> SwReaderPtr;
class SwCursorShell;
class SwSrcView;
class SwPaM;
@@ -231,7 +232,7 @@ public:
{ return const_cast<SwDocShell*>(this)->GetFEShell(); }
/// For inserting document.
- Reader* StartConvertFrom(SfxMedium& rMedium, std::unique_ptr<SwReader>& rpRdr,
+ Reader* StartConvertFrom(SfxMedium& rMedium, SwReaderPtr& rpRdr,
SwCursorShell const * pCursorSh = nullptr, SwPaM* pPaM = nullptr);
#if defined(_WIN32)
diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx
index 219975ff7e86..194ce40d0686 100644
--- a/sw/inc/shellio.hxx
+++ b/sw/inc/shellio.hxx
@@ -29,6 +29,7 @@
#include <tools/ref.hxx>
#include <rtl/ref.hxx>
#include <osl/thread.h>
+#include <o3tl/deleter.hxx>
#include <o3tl/typed_flags_set.hxx>
#include "swdllapi.h"
#include "docfac.hxx"
@@ -172,6 +173,8 @@ protected:
void SetSkipImages( bool bSkipImages ) { mbSkipImages = bSkipImages; }
};
+typedef std::unique_ptr<SwReader, o3tl::default_delete<SwReader>> SwReaderPtr;
+
// Special Readers can be both!! (Excel, W4W, .. ).
enum class SwReaderType {
NONE = 0x00,
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 5e4d9d3af9fc..5a93eaedf06c 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -1061,7 +1061,7 @@ void InsertFile(SwUnoCursor* pUnoCursor, const OUString& rURL,
pMed->Download(); // if necessary: start the download
if( aRef.is() && 1 < aRef->GetRefCount() ) // Ref still valid?
{
- std::unique_ptr<SwReader> pRdr;
+ SwReaderPtr pRdr;
SfxItemSet* pSet = pMed->GetItemSet();
pSet->Put(SfxBoolItem(FN_API_CALL, true));
if(!sPassword.isEmpty())
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index fd10b466dd54..97ada4680c47 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -153,7 +153,7 @@ bool SwDocShell::InsertGeneratedStream(SfxMedium & rMedium,
if (!::sw::XTextRangeToSwPaM(aPam, xInsertPosition))
return false;
// similar to SwView::InsertMedium
- std::unique_ptr<SwReader> pReader;
+ SwReaderPtr pReader;
Reader *const pRead = StartConvertFrom(rMedium, pReader, nullptr, &aPam);
if (!pRead)
return false;
@@ -162,7 +162,7 @@ bool SwDocShell::InsertGeneratedStream(SfxMedium & rMedium,
}
// Prepare loading
-Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, std::unique_ptr<SwReader>& rpRdr,
+Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, SwReaderPtr& rpRdr,
SwCursorShell const *pCursorShell,
SwPaM* pPaM )
{
@@ -231,7 +231,7 @@ Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, std::unique_ptr<SwReade
// Loading
bool SwDocShell::ConvertFrom( SfxMedium& rMedium )
{
- std::unique_ptr<SwReader> pRdr;
+ SwReaderPtr pRdr;
SwRead pRead = StartConvertFrom(rMedium, pRdr);
if (!pRead)
return false; // #129881# return if no reader is found
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 957803246b80..a2df020257fd 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -1613,7 +1613,7 @@ ErrCode SwDocShell::LoadStylesFromFile( const OUString& rURL,
if ( bImport )
{
SwRead pRead = ReadXML;
- std::unique_ptr<SwReader, o3tl::default_delete<SwReader>> pReader;
+ SwReaderPtr pReader;
std::unique_ptr<SwPaM> pPam;
// the SW3IO - Reader need the pam/wrtshell, because only then he
// insert the styles!
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 4caf268458ab..8d2b1e91eabc 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -2158,7 +2158,7 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, std::unique_ptr<SfxMedium> pMediu
pMedium->Download(); // start download if needed
if( aRef.is() && 1 < aRef->GetRefCount() ) // still a valid ref?
{
- std::unique_ptr<SwReader> pRdr;
+ SwReaderPtr pRdr;
Reader *pRead = pDocSh->StartConvertFrom(*pMedium, pRdr, m_pWrtShell.get());
if( pRead ||
(pMedium->GetFilter()->GetFilterFlags() & SfxFilterFlags::STARONEFILTER) )