Kaydet (Commit) f18106b4 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1401334 Uncaught exception

Change-Id: Id6dad66b3c55e5b3049f57e65c857db5abce50b1
Reviewed-on: https://gerrit.libreoffice.org/60901
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 40287a71
......@@ -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)
......
......@@ -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,
......
......@@ -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())
......
......@@ -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
......
......@@ -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!
......
......@@ -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) )
......
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