cid#1401342 Uncaught exception

Change-Id: Ia22ed8541f1148355d71cd5b90ad13e64c1b50c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97289
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2020-06-27 21:47:11 +02:00
parent 22bacc8205
commit d1069a583d
7 changed files with 27 additions and 8 deletions
+2 -1
View File
@@ -35,6 +35,7 @@
#include <com/sun/star/beans/NamedValue.hpp>
#include <unotools/pathoptions.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <o3tl/make_shared.hxx>
#include <vcl/svapp.hxx>
using namespace ::com::sun::star::container;
@@ -435,7 +436,7 @@ std::shared_ptr<SvtFileDialog_Base> SvtFilePicker::implCreateDialog( weld::Windo
{
PickerFlags nBits = getPickerFlags();
auto dialog = std::make_shared<SvtFileDialog>(pParent, nBits);
auto dialog = o3tl::make_shared<SvtFileDialog>(pParent, nBits);
// Set StandardDir if present
if ( !m_aStandardDir.isEmpty())
+2 -1
View File
@@ -24,6 +24,7 @@
#include <vector>
#include <tools/urlobj.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <o3tl/make_shared.hxx>
#include <unotools/pathoptions.hxx>
using namespace ::com::sun::star::container;
@@ -70,7 +71,7 @@ void SAL_CALL SvtFolderPicker::startExecuteModal( const Reference< css::ui::dial
std::shared_ptr<SvtFileDialog_Base> SvtFolderPicker::implCreateDialog( weld::Window* pParent )
{
return std::make_shared<SvtFileDialog>(pParent, PickerFlags::PathDialog);
return o3tl::make_shared<SvtFileDialog>(pParent, PickerFlags::PathDialog);
}
sal_Int16 SvtFolderPicker::implExecutePicker( )
+15
View File
@@ -10,6 +10,7 @@
#ifndef INCLUDED_O3TL_MAKE_SHARED_HXX
#define INCLUDED_O3TL_MAKE_SHARED_HXX
#include <o3tl/deleter.hxx>
#include <memory>
#include <type_traits>
@@ -26,6 +27,20 @@ std::shared_ptr<T> make_shared_array(size_t const size)
return std::shared_ptr<T>(new T[size], std::default_delete<T[]>());
}
/** To markup std::shared_ptr that coverity warns might throw exceptions
which won't throw in practice, or where std::terminate is
an acceptable response if they do
*/
template<class T, class... Args>
std::shared_ptr<T> make_shared(Args&&... args)
{
#if defined(__COVERITY__)
return std::shared_ptr<T>(new T(std::forward<Args>(args)...), o3tl::default_delete<T>());
#else
return std::make_shared<T>(std::forward<Args>(args)...);
#endif
}
} // namespace o3tl
#endif // INCLUDED_O3TL_MAKE_SHARED_HXX
+2 -1
View File
@@ -66,6 +66,7 @@
#include <markdata.hxx>
#include <documentlinkmgr.hxx>
#include <o3tl/make_shared.hxx>
#include <memory>
using namespace com::sun::star;
@@ -793,7 +794,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
break;
case SID_DATA_PROVIDER:
{
std::shared_ptr<ScDocument> xDoc(new ScDocument, o3tl::default_delete<ScDocument>());
auto xDoc = o3tl::make_shared<ScDocument>();
xDoc->InsertTab(0, "test");
ScDocument* pDoc = GetViewData()->GetDocument();
ScDataProviderDlg aDialog(pTabViewShell->GetDialogParent(), xDoc, pDoc);
+2 -1
View File
@@ -71,6 +71,7 @@
#include <PivotLayoutDialog.hxx>
#include <comphelper/lok.hxx>
#include <o3tl/make_shared.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
void ScTabViewShell::SetCurRefDlgId( sal_uInt16 nNew )
@@ -397,7 +398,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
if (!isLOKMobilePhone())
{
// dialog checks, what is in the cell
xResult = std::make_shared<ScFormulaDlg>(pB, pCW, pParent, &GetViewData(),ScGlobal::GetStarCalcFunctionMgr());
xResult = o3tl::make_shared<ScFormulaDlg>(pB, pCW, pParent, &GetViewData(),ScGlobal::GetStarCalcFunctionMgr());
}
break;
}
+2 -2
View File
@@ -99,7 +99,7 @@
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/linguistic2/XLinguProperties.hpp>
#include <o3tl/cppunittraitshelper.hxx>
#include <o3tl/deleter.hxx>
#include <o3tl/make_shared.hxx>
#include <osl/file.hxx>
#include <osl/thread.hxx>
#include <paratr.hxx>
@@ -1013,7 +1013,7 @@ void SwUiWriterTest::testExportRTF()
pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 3, /*bBasicCall=*/false);
// Create the clipboard document.
std::shared_ptr<SwDoc> xClpDoc(new SwDoc, o3tl::default_delete<SwDoc>());
auto xClpDoc = o3tl::make_shared<SwDoc>();
xClpDoc->SetClipBoard(true);
pWrtShell->Copy(xClpDoc.get());
+2 -2
View File
@@ -21,7 +21,7 @@
#include <sal/log.hxx>
#include <comphelper/fileformat.h>
#include <o3tl/deleter.hxx>
#include <o3tl/make_shared.hxx>
#include <tools/fract.hxx>
#include <tools/vcompat.hxx>
#include <tools/urlobj.hxx>
@@ -1361,7 +1361,7 @@ bool ImpGraphic::swapOut()
const INetURLObject aTempFileURL(aTempFile.GetURL());
// Create a swap file
std::shared_ptr<ImpSwapFile> pSwapFile(new ImpSwapFile(aTempFileURL, getOriginURL()), o3tl::default_delete<ImpSwapFile>());
auto pSwapFile = o3tl::make_shared<ImpSwapFile>(aTempFileURL, getOriginURL());
bool bResult = false;