diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-07-16 12:13:01 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-07-17 12:34:12 +0200 |
commit | 8898bae2affc470db4b70baa3050edfad163e2e5 (patch) | |
tree | 5b09c7c4c85f6558d99e69b5914d2f4a9aa6cfd9 /sc | |
parent | 18d9fb3c4ce3829c73a8f1007887c3176d43b06f (diff) |
coverity#1401328 Uncaught exception
Change-Id: I112260f1ea02c2173be56dde1d78497fc8339cec
Reviewed-on: https://gerrit.libreoffice.org/57543
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/document.hxx | 10 | ||||
-rw-r--r-- | sc/source/core/data/documen2.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 16 | ||||
-rw-r--r-- | sc/source/core/data/document10.cxx | 2 |
4 files changed, 16 insertions, 14 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index f2ee35bc693a..4fcee74748ca 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -35,10 +35,11 @@ #include "typedstrdata.hxx" #include "calcmacros.hxx" #include "calcconfig.hxx" +#include <o3tl/deleter.hxx> #include <svl/hint.hxx> -#include <tools/gen.hxx> -#include <svl/zforlist.hxx> #include <svl/typedwhich.hxx> +#include <svl/zforlist.hxx> +#include <tools/gen.hxx> #include <cassert> #include <memory> @@ -49,7 +50,6 @@ #include "markdata.hxx" namespace com { namespace sun { namespace star { namespace chart2 { class XChartDocument; } } } } -namespace o3tl { template <typename T> struct default_delete; } class Timer; @@ -297,6 +297,8 @@ enum ScMutationGuardFlags CORE = 0x0001, /// Core calc data structures should not be mutated }; +typedef std::unique_ptr<ScTable, o3tl::default_delete<ScTable>> ScTableUniquePtr; + class ScDocument { friend class ScValueIterator; @@ -326,7 +328,7 @@ friend class sc::TableColumnBlockPositionSet; friend struct ScMutationGuard; friend struct ScMutationDisable; - typedef std::vector<std::unique_ptr<ScTable>> TableContainer; + typedef std::vector<ScTableUniquePtr> TableContainer; public: enum class HardRecalcState diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index b39d0866be24..f3f63f2811f3 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -783,7 +783,7 @@ bool ScDocument::MoveTab( SCTAB nOldPos, SCTAB nNewPos, ScProgress* pProgress ) pUnoBroadcaster->Broadcast( ScUpdateRefHint( URM_REORDER, aSourceRange, 0,0,nDz ) ); - std::unique_ptr<ScTable> pSaveTab = std::move(maTabs[nOldPos]); + ScTableUniquePtr pSaveTab = std::move(maTabs[nOldPos]); maTabs.erase(maTabs.begin()+nOldPos); maTabs.insert(maTabs.begin()+nNewPos, std::move(pSaveTab)); TableContainer::iterator it = maTabs.begin(); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index fd69d4b25e1f..44699a55a7b3 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -123,7 +123,7 @@ using ::std::set; namespace { -std::pair<SCTAB,SCTAB> getMarkedTableRange(const std::vector<std::unique_ptr<ScTable>>& rTables, const ScMarkData& rMark) +std::pair<SCTAB,SCTAB> getMarkedTableRange(const std::vector<ScTableUniquePtr>& rTables, const ScMarkData& rMark) { SCTAB nTabStart = MAXTAB; SCTAB nTabEnd = 0; @@ -724,7 +724,7 @@ bool ScDocument::DeleteTab( SCTAB nTab ) if ( pUnoBroadcaster ) pUnoBroadcaster->Broadcast( ScUpdateRefHint( URM_INSDEL, aRange, 0,0,-1 ) ); - for (std::unique_ptr<ScTable> & pTab : maTabs) + for (auto & pTab : maTabs) if (pTab) pTab->UpdateDeleteTab(aCxt); @@ -819,7 +819,7 @@ bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets ) if ( pUnoBroadcaster ) pUnoBroadcaster->Broadcast( ScUpdateRefHint( URM_INSDEL, aRange, 0,0,-1*nSheets ) ); - for (std::unique_ptr<ScTable> & pTab : maTabs) + for (auto & pTab : maTabs) if (pTab) pTab->UpdateDeleteTab(aCxt); @@ -1212,7 +1212,7 @@ namespace { struct SetDirtyIfPostponedHandler { - void operator() (std::unique_ptr<ScTable> & p) + void operator() (ScTableUniquePtr & p) { if (p) p->SetDirtyIfPostponed(); @@ -1221,7 +1221,7 @@ struct SetDirtyIfPostponedHandler struct BroadcastRecalcOnRefMoveHandler { - void operator() (std::unique_ptr<ScTable> & p) + void operator() (ScTableUniquePtr & p) { if (p) p->BroadcastRecalcOnRefMove(); @@ -1958,7 +1958,7 @@ void ScDocument::InitUndoSelected( const ScDocument* pSrcDoc, const ScMarkData& for (SCTAB nTab = 0; nTab <= rTabSelection.GetLastSelected(); nTab++) if ( rTabSelection.GetTableSelect( nTab ) ) { - std::unique_ptr<ScTable> pTable(new ScTable(this, nTab, OUString(), bColInfo, bRowInfo)); + ScTableUniquePtr pTable(new ScTable(this, nTab, OUString(), bColInfo, bRowInfo)); if (nTab < static_cast<SCTAB>(maTabs.size())) maTabs[nTab] = std::move(pTable); else @@ -3976,7 +3976,7 @@ void ScDocument::CompileXML() pRangeName->CompileUnresolvedXML(aCxt); std::for_each(maTabs.begin(), maTabs.end(), - [&](std::unique_ptr<ScTable> & pTab) + [&](ScTableUniquePtr & pTab) { if (pTab) pTab->CompileXML(aCxt, aProgress); @@ -6666,7 +6666,7 @@ SCROW ScDocument::GetNotePosition( SCTAB nTab, SCCOL nCol, size_t nIndex ) const void ScDocument::GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const { - for (const std::unique_ptr<ScTable> & pTab : maTabs) + for (const auto & pTab : maTabs) { if (!pTab) continue; diff --git a/sc/source/core/data/document10.cxx b/sc/source/core/data/document10.cxx index de1122d5297f..41a00c7a8a2c 100644 --- a/sc/source/core/data/document10.cxx +++ b/sc/source/core/data/document10.cxx @@ -477,7 +477,7 @@ public: mpCxt->setColumnSet( rpColSet); } - void operator() (std::unique_ptr<ScTable> & p) + void operator() (ScTableUniquePtr & p) { if (p) p->StartListeners(*mpCxt, false); |